Inspectopedia 2026.2 Help

Kotlin script definition is not set up

Reports @KotlinScript-annotated classes that aren't fully set up to be used as a Kotlin script definition.

A class annotated with @KotlinScript describes a script template — files matching its pattern (for example *.my.kts) are expected to use its compilation configuration and dependencies. Two things make a definition fully usable, and this inspection reports either being missing:

  1. Registration in Kotlin scripting settings. Without an entry in Settings → Languages & Frameworks → Kotlin → Kotlin Scripting → "Script definition classes to load", your IDE will not recognize matching .kts files as scripts of this definition. The quick-fix "Register definition in Kotlin scripting settings" populates the FQN (and the owning module's classpath) into the settings.

  2. Marker file at META-INF/kotlin/script/templates/<fqn>.classname packed into the resulting JAR. Library-based discovery (ScriptDefinitionsProvider) scans dependency JARs for this empty marker file to find available templates; consumers of your library won't auto-discover this definition without it. The quick-fix "Create marker file for downstream auto-discovery" creates the file under the module's first resource root.

Apply whichever quick-fixes are relevant — both for the typical library-author flow, or only registration when the template is consumed locally and never published.

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

KotlinScriptTemplateNotRegistered
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Kotlin | Probable bugs

Inspection ID: KotlinScriptTemplateNotRegistered

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection KotlinScriptTemplateNotRegistered

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2026.2, Qodana for JVM 2026.2,

Last modified: 30 June 2026