Skip to content
Latchkey

TeamCity "Failed to load Kotlin DSL" settings.kts error in CI

TeamCity compiles the versioned .teamcity/settings.kts Kotlin DSL to build the project configuration. A compile error, wrong DSL version, or bad reference stops the settings from loading and the project shows an error.

What this error means

The project shows "Failed to load DSL" or "Error while loading settings from ...": a Kotlin compilation error naming a line in settings.kts or a _Self file.

TeamCity
Failed to load Kotlin DSL settings:
.teamcity/settings.kts:42:17: error: unresolved reference: dockerCommand

Common causes

A Kotlin DSL compilation error

An unresolved reference, a syntax error, or an API used incorrectly in settings.kts fails compilation, so the configuration cannot be built.

A DSL version mismatch with the server

The version = "..." in the DSL does not match features available on the server, so a symbol the code uses does not exist.

How to fix it

Fix the compile error at the reported line

  1. Open .teamcity/settings.kts at the line and column in the error.
  2. Correct the unresolved reference or syntax, matching the DSL API for your server version.
  3. Push and let TeamCity reload the settings, or use "Load project settings" to recompile.
.teamcity/settings.kts
// .teamcity/pom.xml or settings.kts version must match the server
version = "2024.03"

Align the DSL version and dependencies

Set the DSL version to match the server and ensure the .teamcity Maven/Gradle setup pulls the matching configs-dsl-kotlin artifacts so symbols resolve.

How to prevent it

  • Compile the DSL locally (Maven/Gradle) before pushing settings changes.
  • Keep the DSL version aligned with the TeamCity server version.
  • Review settings.kts changes like code, since they gate the whole project.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →