Skip to content
Latchkey

sbt "class file has wrong version 61.0, should be 55.0" in CI

The compiler read a class file targeting a newer bytecode level than the JDK running the build supports. Major version 61 is Java 17 and 55 is Java 11, so a Java 17 dependency cannot be consumed by a build running on Java 11. Align the CI JDK with the dependency.

What this error means

scalac or a downstream step fails with "class file has wrong version 61.0, should be 55.0" (or similar major numbers) while reading a dependency.

scalac
[error] error: class file 'Foo.class' has wrong version 61.0, should be 55.0
[error] Please recompile 'Foo.class' with a Java 11 compatible compiler or run with a newer JDK

Common causes

A dependency built for a newer JDK

A library compiled to target Java 17 (major 61) cannot be read by a build running on Java 11 (major 55).

setup-java pinned an older JDK than the build needs

The CI JDK from setup-java is older than the one the dependency or the project targets, causing the version mismatch.

How to fix it

Match the CI JDK to the required bytecode level

  1. Map the major version in the error (61 is 17, 55 is 11) to a JDK.
  2. Set setup-java to a JDK at least as new as the dependency needs.
  3. Re-run so the compiler can read the class files.
.github/workflows/ci.yml
- uses: actions/setup-java@v4
  with:
    distribution: temurin
    java-version: '17'

Target older bytecode if you must stay on Java 11

If the runtime is fixed to Java 11, use a dependency built for Java 11 or set -release 11 so output stays compatible.

build.sbt
scalacOptions ++= Seq("-release", "11")

How to prevent it

  • Pin the CI JDK with setup-java to match your dependencies and target.
  • Use -release to fix the bytecode target explicitly.
  • Verify dependency JDK targets before upgrading them.

Frequently asked questions

What causes ""class file has wrong version 61.0, should be 55.0""?
A library compiled to target Java 17 (major 61) cannot be read by a build running on Java 11 (major 55).
How do I fix "class file has wrong version 61.0, should be 55.0"?
Match the CI JDK to the required bytecode level

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card