sbt "Reference to undefined setting" / no such task in CI
sbt tried to evaluate a setting or task that references a key which is not defined in the current scope. The build definition names a setting from a plugin or scope that is not actually available there.
What this error means
sbt fails while loading the build with "Reference to undefined setting: ProjectRef(...)/key" or a message that a referenced task does not exist in that project.
[error] Reference to undefined setting:
[error] myproject / assembly / assemblyMergeStrategy from myproject / assembly
[error] Did you mean myproject / assembly / assemblyJarName ?Common causes
A setting is referenced without its plugin enabled
The build reads a plugin-provided key (like an assembly setting) in a project where the plugin is not enabled, so the key is undefined there.
A key used in the wrong scope
A task-scoped key is referenced at build or project scope where it does not exist, so sbt cannot resolve it.
How to fix it
Enable the plugin on the project that uses the key
- Identify which plugin defines the referenced setting.
- Enable it on the project with
enablePlugins. - Reload the build to confirm the key resolves.
lazy val app = (project in file("app"))
.enablePlugins(AssemblyPlugin)Reference the key in its correct scope
Scope the setting to the task and configuration it belongs to so sbt can find its definition.
assembly / assemblyMergeStrategy := {
case "reference.conf" => MergeStrategy.concat
case x => (assembly / assemblyMergeStrategy).value(x)
}How to prevent it
- Enable a plugin on every project whose settings you reference.
- Scope plugin keys to the correct task and configuration.
- Reload the build locally after editing build.sbt to catch scope errors.