oracle/graal · error · IllegalArgumentException
Unknown class ${className} for constant${value}
Error message
Unknown class ${className} for constant${value} What it means
Mirror of error 144 on the read side: while deserializing a primitive constant, the 'class' field in the JSON must be one of Integer, Byte, Short, Long, Float, Double. Any other class name hits the default branch and throws IllegalArgumentException naming the unknown class and raw hex value.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/JsonReplayCodec.java:484
case "Integer" -> {
return Integer.parseUnsignedInt(value, HEX_RADIX);
}
case "Byte" -> {
return (byte) Integer.parseUnsignedInt(value, HEX_RADIX);
}
case "Short" -> {
return (short) Integer.parseUnsignedInt(value, HEX_RADIX);
}
case "Long" -> {
return Long.parseUnsignedLong(value, HEX_RADIX);
}
case "Float" -> {
return hexToFloat(value);
}
case "Double" -> {
return hexToDouble(value);
}
default -> throw new IllegalArgumentException("Unknown class " + className + " for constant" + value);
}
}
}
private static final class ResultMarkerSerializer implements ObjectSerializer {
@Override
public boolean serializesSubclasses() {
return true;
}
@Override
public Class<?> clazz() {
return SpecialResultMarker.class;
}
@Override
public String tag() {View on GitHub (pinned to a66e9ccd1d)
Solutions
- Use the same (or newer) GraalVM version to replay the file than the one that recorded it
- Inspect the offending entry in the JSON (class/value pair from the message) and fix or remove it if the file was hand-edited
- If you extended the writer (error 144), extend the reader switch with the matching cases
Example fix
// before
switch (className) {
case "Integer" -> { ... }
default -> throw new IllegalArgumentException("Unknown class " + className + ...
// after: add
case "Boolean" -> Boolean.parseBoolean(value);
case "Character" -> (char) Integer.parseUnsignedInt(value, HEX_RADIX); Defensive patterns
Strategy: validation
Validate before calling
static final Set<String> SUPPORTED_CONSTANT_CLASSES =
Set.of("Integer", "Byte", "Short", "Long", "Float", "Double");
if (!SUPPORTED_CONSTANT_CLASSES.contains(className)) {
throw new IllegalArgumentException("Replay file uses unsupported constant class: " + className);
} Prevention
- Never replay files from newer GraalVM builds on older ones
- Keep the serialize and deserialize switches side by side and update both together
When it happens
Trigger: Replaying a JSON replay file that contains a constant entry with a class name this codec version does not recognize — e.g. 'Boolean' written by a newer codec, or a hand-edited/garbled file.
Common situations: Version skew: file written by a GraalVM that supports more primitive classes than the reading one; manual JSON edits; truncated/corrupt replay files where the class field reads as a wrong string.
Related errors
- The replay map does not contain a tag: ${map}
- Expected a map.
- Failed to serialize ${op} due to: ${cause}
- No singleton found for ${registration}
- Invalid marker type.
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/b7f069cbc53f4e85.
Report an issue: GitHub.