Skip to content
Latchkey

sbt cross-version / binary version conflict

Two artifacts on the classpath were compiled for different Scala binary versions. sbt refuses to mix, for example, _2.13 and _3 builds of the same library.

What this error means

update or eviction reporting fails with conflicting cross-version suffixes, naming the artifact and the two suffixes. It is deterministic given the dependency set.

sbt
[error] Modules were resolved with conflicting cross-version suffixes in ProjectRef:
[error]    com.example:widget _2.13, _3

Common causes

A dependency uses %% with a wrong scalaVersion

One library was added with a hardcoded suffix while the project moved to a different Scala version, so suffixes diverge.

A transitive dep pulls an incompatible build

A third-party library brings in another module built for a different Scala binary version.

How to fix it

Align all libraries to one Scala version

  1. Set a single scalaVersion for the project.
  2. Use %% everywhere so suffixes follow scalaVersion automatically.
  3. Remove any hardcoded _2.13 / _3 artifact names.

Find which dependency pulls the wrong build

Inspect the dependency tree to locate the offending transitive artifact.

CI step
sbt evicted
sbt "whatDependsOn com.example widget"

Use the cross-compatible release

Upgrade the lagging library to a version published for your Scala binary version, or exclude the bad transitive and add the right one.

How to prevent it

  • Standardize on one Scala version per build.
  • Prefer %% over hardcoded suffixes.
  • Review sbt evicted after dependency bumps.

Related guides

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