oracle/graal · error · IllegalArgumentException
Unknown registration
Error message
Unknown registration
What it means
On the write path, registrationIndex looks up the CompilerInterfaceDeclarations.Registration's class in the codec's registrationIndices map; a miss throws IllegalArgumentException 'Unknown registration <class name>'. The registration table used by the codec instance does not contain the class of a value the writer is trying to encode as a registered (singleton or instance) object.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java:1083
out.write(value ? 1 : 0);
}
private static boolean readBooleanFlag(ObjectCopierInputStream in) throws IOException {
int value = in.read();
if (value < 0) {
throw new EOFException();
}
return switch (value) {
case 0 -> false;
case 1 -> true;
default -> throw new IOException("Invalid replay boolean flag " + value);
};
}
private int registrationIndex(CompilerInterfaceDeclarations.Registration registration) {
Integer index = registrationIndices.get(registration.clazz());
if (index == null) {
throw new IllegalArgumentException("Unknown registration " + registration.clazz().getName());
}
return index;
}
private static Object readSpecialSingleton(int kind) throws IOException {
return switch (kind) {
case SINGLETON_NULL_POINTER -> JavaConstant.NULL_POINTER;
case SINGLETON_COMPRESSED_NULL -> HotSpotCompressedNullConstant.COMPRESSED_NULL;
case SINGLETON_NO_SPECULATION -> SpeculationLog.NO_SPECULATION;
case SINGLETON_ILLEGAL_VALUE_KIND -> ValueKind.Illegal;
default -> throw new IOException("Unknown replay singleton kind " + kind);
};
}
private Class<?> arrayComponentType(Object[] array) {
Class<?> componentType = array.getClass().getComponentType();
Class<?> registeredSupertype = declarations.findRegisteredSupertype(componentType);
return (registeredSupertype != null) ? registeredSupertype : componentType;View on GitHub (pinned to a66e9ccd1d)
Solutions
- Ensure the value's class is registered in the same CompilerInterfaceDeclarations instance the codec was built from
- Register the class before recording: declarations.register(clazz, singleton)
- Re-create the codec after all registrations are performed, so registrationIndices is built from the full set
Example fix
// before BinaryReplayCodec codec = new BinaryReplayCodec(declarations); // built too early declarations.register(NewType.class, false); codec.write(...); // Unknown registration NewType // after declarations.register(NewType.class, false); BinaryReplayCodec codec = new BinaryReplayCodec(declarations); // built after registrations codec.write(...);
Defensive patterns
Strategy: validation
Validate before calling
static boolean registrationKnown(CompilerInterfaceDeclarations d, Class<?> clazz) {
return d.findRegistration(clazz) != null; // or expose registrationIndices lookup
} Try / catch
try {
codec.writeValues(values);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Unknown registration")) {
// register the class and rebuild the codec, or skip recording
} else throw e;
} Prevention
- Complete all CompilerInterfaceDeclarations registrations before constructing BinaryReplayCodec
- Add a startup assertion that every recorded value's class resolves to a registration index
When it happens
Trigger: Recording a value whose Registration was obtained from a different CompilerInterfaceDeclarations configuration than the one the codec was constructed with; adding a new registered compiler type without adding it to the table the codec indexes.
Common situations: Split-brain registration configuration (some registrations registered in one declarations instance, codec built from another); extending the compiler interface types without updating the replay registration set.
Related errors
- No serializer for :
- Unexpected marker
- Unexpected architecture ${architecture}
- Unexpected architecture name ${archName}
- Unexpected register config ${registerConfig}
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/4f1d91cedd5d7362.
Report an issue: GitHub.