Skip to content
Latchkey

Scala sbt "Conflicting cross-version suffixes" (_2.12 vs _2.13) in CI

sbt detected the same module on the classpath compiled for two different Scala binary versions (for example _2.12 and _2.13). Mixing Scala binaries is unsafe, so it fails the build instead of linking them.

What this error means

sbt update fails with "[error] Conflicting cross-version suffixes in: <org>:<name>: _2.12, _2.13", naming the module pulled in for both binaries.

sbt
[error] Modules were resolved with conflicting cross-version suffixes in ProjectRef(...):
[error]    com.typesafe.akka:akka-actor _2.12, _2.13
[error] sbt.librarymanagement.EvictionWarningOptions ...

Common causes

A hardcoded suffix pins the wrong binary

A dependency written with % and a literal name_2.12 pulls the 2.12 build while the project compiles for 2.13.

A transitive dependency targets another Scala binary

A library built against a different Scala version drags in _2.12 artifacts alongside your _2.13 ones.

How to fix it

Use %% so the suffix follows the project

  1. Find the dependency with a literal _2.12/_2.13 suffix.
  2. Replace % plus the suffixed name with %% and the bare name.
  3. Re-run sbt update so a single binary version resolves.
build.sbt
// before: "com.typesafe.akka" % "akka-actor_2.12" % "2.6.20"
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.6.20"

Align scalaVersion with the dependencies

When a needed library only ships for one binary, set scalaVersion to that binary so everything matches.

build.sbt
scalaVersion := "2.13.14"

How to prevent it

  • Always use %% for Scala libraries so the binary suffix is automatic.
  • Keep scalaVersion consistent across subprojects.
  • Inspect evicted output when adding cross-built dependencies.

Related guides

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