oracle/graal · error · IOException
unknown klass type :
Error message
unknown klass type :
What it means
While reading a POOL_CLASS entry, BinaryReader reads a one-byte klass-type discriminator that must be either ENUM_KLASS or KLASS. Any other byte means the reader has lost alignment with the writer's encoding: the stream is corrupt, truncated, or written by an incompatible/buggy producer. The IOException with the offending byte value aborts parsing of the pool.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/parsing/BinaryReader.java:662
switch (type) {
case POOL_CLASS: {
String name = dataSource.readString();
String conv = nameTranslator == null ? null : nameTranslator.translate(name);
if (conv != null) {
name = conv;
}
int klasstype = dataSource.readByte();
if (klasstype == ENUM_KLASS) {
int len = dataSource.readInt();
String[] values = new String[len];
for (int i = 0; i < len; i++) {
values[i] = readPoolObject(String.class);
}
obj = new EnumKlass(name, values);
} else if (klasstype == KLASS) {
obj = new Klass(name);
} else {
throw new IOException("unknown klass type : " + klasstype);
}
break;
}
case POOL_ENUM: {
EnumKlass enumClass = readPoolObject(EnumKlass.class);
int ordinal = dataSource.readInt();
obj = enumClass.get(ordinal);
break;
}
case POOL_NODE_CLASS: {
String className;
if (dataSource.getMajorVersion() < 2) {
className = dataSource.readString();
} else {
Klass nodeClass = readPoolObject(Klass.class);
className = nodeClass.toString();
}
String nameTemplate = dataSource.readString();View on GitHub (pinned to a66e9ccd1d)
Solutions
- Re-dump the graph with a stock (unmodified) GraalVM producer and retry.
- Validate the file starts with the BIGV magic and a supported version before full parse.
- If you maintain a custom writer that added a new klass type, teach the reader (BinaryReader) about it or stop emitting it.
- Check the numeric value in the message: 0/1 expected; anything else indicates desynchronization earlier in the stream, so inspect preceding pool entries.
Defensive patterns
Strategy: try-catch
Try / catch
try { reader.parse(); } catch (IOException e) { if (e.getMessage().startsWith("unknown klass type")) { /* stream desynced; regenerate dump */ } } Prevention
- Check the BIGV magic and version header before parsing.
- Regenerate dumps rather than repairing damaged ones.
- Keep custom writers and readers in lockstep for any new entry encodings.
When it happens
Trigger: Parsing a corrupted or byte-shifted BGV file (e.g. a single dropped byte earlier in the stream); reading a file written by a modified GraphProtocol subclass that emits a klass discriminator the standard reader does not know; reading arbitrary non-BGV data that happened to pass earlier checks.
Common situations: Truncated dumps after JVM crashes, files damaged in transfer, files produced by experimental forks of the graph writer, or wrong file opened by a viewer.
Related errors
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/ca7f626112be551c.
Report an issue: GitHub.