oracle/graal · error · VersionMismatchException

File format version {} unsupported. Current version is {}

Error message

File format version {} unsupported.  Current version is {}

What it means

setVersion rejects a graph dump (BIGV format) whose major/minor version is newer than the version this StreamSource can parse (currently 8.0). It exists to fail fast instead of misreading a format written by a newer GraalVM.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/parsing/StreamSource.java:149

    @Override
    public byte[] readBytes(int len) throws IOException {
        return readBytes(new byte[len], len);
    }

    @Override
    public byte[] readBytes(byte[] b, int len) throws IOException {
        in.readFully(b, 0, len);
        return b;
    }

    @Override
    public long getMark() {
        throw new UnsupportedOperationException("getMark");
    }

    private void setVersion(int newMajorVersion, int newMinorVersion) throws IOException {
        if (newMajorVersion > CURRENT_MAJOR_VERSION || (newMajorVersion == CURRENT_MAJOR_VERSION && newMinorVersion > CURRENT_MINOR_VERSION)) {
            throw new VersionMismatchException("File format version " + versionPair(newMajorVersion, newMinorVersion) + " unsupported.  Current version is " + CURRENT_VERSION);
        }
        majorVersion = newMajorVersion;
        minorVersion = newMinorVersion;
    }

    @Override
    public int getMajorVersion() {
        return majorVersion;
    }

    public int getMinorVersion() {
        return minorVersion;
    }

    @Override
    public void startDigest() {
    }

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Read the file with a graphio version >= the version that produced the dump (upgrade the GraalVM/visualizer doing the reading)
  2. Re-dump the graphs using the same (older) GraalVM version that your reader supports, disabling newer-only dump features
  3. If you control the format, check the version pair before parsing and surface a clear 'file version X vs supported Y' message

Example fix

// before
GraphReader r = new GraphReader(new StreamSource(in));
r.parseDocument(); // VersionMismatchException mid-header

// after (gate on version first)
DataSource src = new StreamSource(in);
if (src.getMajorVersion() > StreamSource.CURRENT_MAJOR_VERSION) {
    throw new IOException("dump too new: " + src.getMajorVersion() + "." + src.getMinorVersion());
}
new GraphReader(src).parseDocument();
Defensive patterns

Strategy: validation

Validate before calling

// after reading the header, before full parse:
if (src.getMajorVersion() > StreamSourceMajorLimit ||
    (src.getMajorVersion() == StreamSourceMajorLimit && src.getMinorVersion() > MinorLimit)) {
    // refuse with a clear message instead of a mid-parse VersionMismatchException
}

Try / catch

try { reader.parseDocument(); } catch (VersionMismatchException e) { /* tell user to upgrade reader or re-dump with older version */ }

Prevention

When it happens

Trigger: Reading the version header (readShort/readInt pair after the BIGV magic) of a .bgv file exported by a newer GraalVM whose major version > 8 (or equal-major with larger minor) into an older graphio parser via GraphReader/StreamSource.setVersion.

Common situations: Opening a graph dump produced by a newer IDE/plugin or newer graal compiler with an older visualizer/library; mixing GraalVM versions between producer and consumer of -Dgraal.Dump output.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/c6259f9671667d02. Report an issue: GitHub.