Skip to content
Latchkey

sbt "Unsupported class file major version" in CI

A bytecode-processing tool (ASM inside a plugin, a coverage or shading step) encountered class files from a JDK newer than it understands and threw "Unsupported class file major version N". The tool or the JDK must be aligned.

What this error means

sbt fails with "IllegalArgumentException: Unsupported class file major version 65" (or 64/63) from an assembly, coverage, or bytecode-manipulating plugin.

sbt
[error] java.lang.IllegalArgumentException: Unsupported class file major version 65
[error]   at org.objectweb.asm.ClassReader.<init>(ClassReader.java:...)

Common causes

A plugin bundles an old ASM version

The bytecode library inside a plugin predates the JDK running the build (major 65 is Java 21), so it cannot parse the newer class files.

The CI JDK is newer than the tooling supports

setup-java installed a JDK ahead of what the plugin ecosystem handles, so a build step that reads bytecode fails.

How to fix it

Upgrade the plugin that bundles ASM

  1. Identify the plugin doing bytecode work (assembly, coverage, shading).
  2. Upgrade it to a version that supports the JDK in use.
  3. Re-run the step.
project/plugins.sbt
// project/plugins.sbt
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0")

Pin the CI JDK to a supported version

If a plugin cannot yet handle the newest JDK, set setup-java to a version it supports.

.github/workflows/ci.yml
- uses: actions/setup-java@v4
  with:
    distribution: temurin
    java-version: '17'

How to prevent it

  • Keep bytecode-manipulating plugins current with your JDK.
  • Pin the CI JDK to a version your plugin set supports.
  • Test a JDK bump against the full plugin toolchain before adopting it.

Frequently asked questions

What causes ""Unsupported class file major version""?
The bytecode library inside a plugin predates the JDK running the build (major 65 is Java 21), so it cannot parse the newer class files.
How do I fix "Unsupported class file major version"?
Upgrade the plugin that bundles ASM

Related guides

References

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