Skip to content
Latchkey

Gradle "settings file ... evaluation failed" - Fix settings.gradle in CI

Gradle failed while evaluating settings.gradle(.kts) - the very first script it runs. A syntax error, a bad include, or a malformed pluginManagement/dependencyResolutionManagement block stops the build before any project is configured.

What this error means

The build fails immediately with a settings-file error: Could not compile settings file or settings file '.../settings.gradle' line: N ... evaluation failed, pointing at the offending line.

gradle output
FAILURE: Build failed with an exception.
* Where: Settings file '/workspace/settings.gradle.kts' line: 12
* What went wrong:
Could not compile settings file '/workspace/settings.gradle.kts'.
> Unresolved reference: gradlePluginPortl

Common causes

Syntax error or typo in settings

A misspelled method (gradlePluginPortl), a missing brace, or invalid Kotlin/Groovy in settings.gradle fails to compile, so Gradle cannot start.

Bad include or repository-management block

An include(":missing-module") for a directory that does not exist, or a malformed dependencyResolutionManagement { repositories { ... } }, makes settings evaluation throw.

How to fix it

Fix the line the error points at

The line: N and the compile message name the exact problem. Correct the typo or the block.

settings.gradle.kts
// settings.gradle.kts
pluginManagement {
    repositories { gradlePluginPortal() }   // not gradlePluginPortl
}
rootProject.name = "app"
include(":core", ":api")   // each must be a real directory

Validate includes and repositories

  1. Confirm every include(":x") maps to an existing directory.
  2. Check dependencyResolutionManagement/pluginManagement blocks are well-formed.
  3. Run ./gradlew help to evaluate settings without running a real task.

How to prevent it

  • Keep settings.gradle minimal and validate it with ./gradlew help.
  • Use the IDE/Kotlin DSL completion to avoid method typos in settings.
  • Ensure included module directories exist before referencing them.

Related guides

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