oracle/graal · error · VersionMismatchException
File header is missing
Error message
File header is missing
What it means
On start, BinaryReader.readHeader looks for the 'BIGV' magic followed by a version pair; if no magic is found the major version stays 0 (or the header parse yields < 1), and parsing aborts with VersionMismatchException('File header is missing'). This means the input is not a graph dump at all, or it uses a pre-versioning (ancient) layout that the current reader refuses.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/parsing/BinaryReader.java:846
hashStack.push(null);
boolean restart = false;
long start = System.nanoTime();
try {
while (true) { // TERMINATION ARGUMENT: finite length of data source will result in
// EOFException eventually.
// allows to concatenate BGV files; at the top-level, either BIGV signature,
// or 0x00-0x02 should be present.
// Check for a version specification
if (dataSource.readHeader() && restart) {
// if not at the start of the stream, reinitialize the constant pool.
closeDanglingGroups();
builder.resetStreamData();
constantPool = builder.getConstantPool();
}
restart = true;
if (dataSource.getMajorVersion() < 1) {
throw new VersionMismatchException("File header is missing");
}
parseRoot();
}
} catch (EOFException e) {
// ignore
} finally {
// also terminates the builder
closeDanglingGroups();
if (TRACE_PARSE_TIME) {
long end = System.nanoTime();
System.err.println(((System.nanoTime() - timeStart) / 1_000_000) + " Parsed file in " + ((end - start) / 1_000_000) + " ms");
}
}
return builder.rootDocument();
}
protected void beginGroup() throws IOException {View on GitHub (pinned to a66e9ccd1d)
Solutions
- Verify the input starts with bytes 'B','I','G','V' before handing it to the reader.
- Re-export the graph dump with a current GraalVM producer so the header is present.
- If concatenating dumps, keep each chunk's BIGV header (the reader supports restarts on it).
Example fix
// validation before parsing
byte[] head = new byte[4];
try (FileInputStream in = new FileInputStream(f)) {
if (in.read(head) != 4 || !(head[0]=='B' && head[1]=='I' && head[2]=='G' && head[3]=='V')) {
throw new IllegalArgumentException(f + " is not a BIGV graph dump");
}
} Defensive patterns
Strategy: validation
Validate before calling
byte[] m = new byte[4];
try (var in = new java.io.FileInputStream(file)) {
if (in.read(m) != 4 || !java.util.Arrays.equals(m, new byte[]{'B','I','G','V'})) {
throw new IllegalArgumentException("Not a BIGV graph dump: " + file);
}
} Try / catch
try { reader.parse(); } catch (VersionMismatchException e) { if (e.getMessage().contains("File header is missing")) { rejectNonDumpInput(); } } Prevention
- Validate the BIGV magic bytes before invoking the reader.
- Keep each concatenated chunk's header intact.
- Give files explicit .bgv extensions and route them explicitly to the graph reader.
When it happens
Trigger: Passing a plain BGV body without the BIGV header; opening an unrelated file (text, class file, zip) with the graph reader; reading from a stream position before the header was written.
Common situations: Wrong file passed to IGV or a programmatic reader; header stripped by preprocessing; concatenation logic that dropped the first chunk's header.
Related errors
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/e33ee1a52ed0ffc9.
Report an issue: GitHub.