Language edition/toolchain drift

Gradle 9 Kotlin DSL unresolved label this@Build_gradle Kotlin 2 K2 script label

A `.gradle.kts` script that worked under Gradle 8 now reports an unresolved label or receiver mismatch.

Gradle 9 / Kotlin DSLJVM build systemsLanguage edition/toolchain driftgradle9

Agent Quick Fix

Repair against the current Gradle 9 / Kotlin DSL contract, then keep the change narrow and source-backed.

Product: Gradle 9 / Kotlin DSL
Current-contract area: Kotlin DSL script label `this@Build_gradle` stops compiling
Likely root cause: A `.gradle.kts` script that worked under Gradle 8 now reports an unresolved label or receiver mismatch.
Repair direction: Verifier checks idiomatic migration while preserving cross-version intent where required.

Symptom

A `.gradle.kts` script that worked under Gradle 8 now reports an unresolved label or receiver mismatch.

Why This Happens

Source may compile under an older edition/toolchain; current edition migration rules and tool metadata are external to the repo's immediate error context.

Common Wrong Fixes

  • Changing local code without checking the current external contract.
  • Retrying the same install, build, or API call with no version/source change.
  • Applying a broad unsafe bypass when a narrow compatibility fix is available.

Codex Search Keywords

These are the search terms observed in a neutral Codex validation run for this failure shape.

Gradle 9 Kotlin DSL unresolved label this@Build_gradle Kotlin 2 K2 script label
Gradle 9.0 release notes Kotlin DSL Kotlin 2.2
Gradle 9 upgrade guide Kotlin DSL

Source Trail