{"record":{"id":"4f1d91cedd5d7362","repo":"oracle/graal","slug":"unknown-registration","errorCode":null,"errorMessage":"Unknown registration ","messagePattern":"Unknown registration ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java","lineNumber":1083,"sourceCode":"        out.write(value ? 1 : 0);\n    }\n\n    private static boolean readBooleanFlag(ObjectCopierInputStream in) throws IOException {\n        int value = in.read();\n        if (value < 0) {\n            throw new EOFException();\n        }\n        return switch (value) {\n            case 0 -> false;\n            case 1 -> true;\n            default -> throw new IOException(\"Invalid replay boolean flag \" + value);\n        };\n    }\n\n    private int registrationIndex(CompilerInterfaceDeclarations.Registration registration) {\n        Integer index = registrationIndices.get(registration.clazz());\n        if (index == null) {\n            throw new IllegalArgumentException(\"Unknown registration \" + registration.clazz().getName());\n        }\n        return index;\n    }\n\n    private static Object readSpecialSingleton(int kind) throws IOException {\n        return switch (kind) {\n            case SINGLETON_NULL_POINTER -> JavaConstant.NULL_POINTER;\n            case SINGLETON_COMPRESSED_NULL -> HotSpotCompressedNullConstant.COMPRESSED_NULL;\n            case SINGLETON_NO_SPECULATION -> SpeculationLog.NO_SPECULATION;\n            case SINGLETON_ILLEGAL_VALUE_KIND -> ValueKind.Illegal;\n            default -> throw new IOException(\"Unknown replay singleton kind \" + kind);\n        };\n    }\n\n    private Class<?> arrayComponentType(Object[] array) {\n        Class<?> componentType = array.getClass().getComponentType();\n        Class<?> registeredSupertype = declarations.findRegisteredSupertype(componentType);\n        return (registeredSupertype != null) ? registeredSupertype : componentType;","sourceCodeStart":1065,"sourceCodeEnd":1101,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java#L1065-L1101","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nBinaryReplayCodec codec = new BinaryReplayCodec(declarations); // built too early\ndeclarations.register(NewType.class, false);\ncodec.write(...); // Unknown registration NewType\n\n// after\ndeclarations.register(NewType.class, false);\nBinaryReplayCodec codec = new BinaryReplayCodec(declarations); // built after registrations\ncodec.write(...);","handlingStrategy":"validation","validationCode":"static boolean registrationKnown(CompilerInterfaceDeclarations d, Class<?> clazz) {\n    return d.findRegistration(clazz) != null; // or expose registrationIndices lookup\n}","typeGuard":null,"tryCatchPattern":"try {\n    codec.writeValues(values);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Unknown registration\")) {\n        // register the class and rebuild the codec, or skip recording\n    } else throw e;\n}","preventionTips":["Complete all CompilerInterfaceDeclarations registrations before constructing BinaryReplayCodec","Add a startup assertion that every recorded value's class resolves to a registration index"],"tags":["graalvm","replay-compilation","registration","serialization","configuration"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}