Skip to content
Latchkey

Kotlin "incompatible Kotlin/Gradle plugin version" in CI

A library on the classpath was compiled with a newer Kotlin than the compiler your build runs. The metadata versions do not match, so the build cannot read the module reliably and fails.

What this error means

The build fails with "e: ... Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is X.Y.Z, expected version is A.B.C".

kotlin
e: /home/runner/.gradle/.../lib.jar!/META-INF/lib.kotlin_module:
Module was compiled with an incompatible version of Kotlin.
The binary version of its metadata is 2.0.0, expected version is 1.9.0.

Common causes

The Kotlin Gradle plugin is older than a dependency

A dependency built with a newer Kotlin carries metadata the older Kotlin Gradle plugin in your build cannot read.

Mismatched Kotlin versions across modules

Subprojects or the stdlib resolve to different Kotlin versions, producing incompatible metadata on one classpath.

How to fix it

Align the Kotlin plugin version

  1. Read the expected and found metadata versions in the error.
  2. Raise the Kotlin Gradle plugin to match or exceed the dependency.
  3. Re-run so the compiler can read the newer metadata.
build.gradle.kts
plugins {
    kotlin("jvm") version "2.0.0"
}

Pin one Kotlin version across modules

Constrain the stdlib and plugin to a single version so every module emits compatible metadata.

build.gradle.kts
dependencies {
    implementation(platform("org.jetbrains.kotlin:kotlin-bom:2.0.0"))
}

How to prevent it

  • Keep the Kotlin Gradle plugin at least as new as your dependencies.
  • Use the Kotlin BOM to pin one version across modules.
  • Upgrade Kotlin and dependencies together.

Frequently asked questions

What causes ""was compiled with an incompatible version""?
A dependency built with a newer Kotlin carries metadata the older Kotlin Gradle plugin in your build cannot read.
How do I fix "was compiled with an incompatible version"?
Align the Kotlin plugin version

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card