{"record":{"id":"f0dfe66a94ddfa1e","repo":"oracle/graal","slug":"no-serializer-for","errorCode":null,"errorMessage":"No serializer for  : ","messagePattern":"No serializer for  : ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java","lineNumber":812,"sourceCode":"                if (value == ValueKind.Illegal) {\n                    out.write(SPECIAL_SINGLETON_TAG);\n                    out.writePackedUnsignedInt(SINGLETON_ILLEGAL_VALUE_KIND);\n                    return;\n                }\n                CompilerInterfaceDeclarations.Registration registration = declarations.isRegisteredClassInstance(value) ? declarations.findRegistrationForInstance(value) : null;\n                if (registration != null) {\n                    int registrationIndex = registrationIndex(registration);\n                    if (registration.singleton()) {\n                        out.write(REGISTERED_SINGLETON_TAG);\n                        out.writePackedUnsignedInt(registrationIndex);\n                    } else {\n                        out.write(REGISTERED_INSTANCE_TAG);\n                        out.writePackedUnsignedInt(registrationIndex);\n                        out.writePackedUnsignedInt(state.instanceId(registrationIndex, value));\n                    }\n                    return;\n                }\n                throw new IllegalArgumentException(\"No serializer for \" + value.getClass() + \": \" + value);\n            }\n        }\n    }\n\n    @SuppressWarnings({\"unchecked\", \"rawtypes\"})\n    private static Object readValue(ObjectCopierInputStream in, ReadState state) throws IOException {\n        int tag = in.read();\n        if (tag < 0) {\n            throw new EOFException();\n        }\n        return switch (tag) {\n            case NULL_TAG -> null;\n            case FALSE_TAG -> false;\n            case TRUE_TAG -> true;\n            case BYTE_TAG -> in.readByteValue();\n            case SHORT_TAG -> in.readShort();\n            case INT_TAG -> in.readPackedSignedInt();\n            case LONG_TAG -> in.readPackedSignedLong();","sourceCodeStart":794,"sourceCodeEnd":830,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java#L794-L830","documentation":"Thrown by BinaryReplayCodec.writeValue when an object being serialized is of a class that has no Registration in CompilerInterfaceDeclarations and matches none of the codec's built-in tag cases. The binary replay format can only encode registered types (singletons or registered instances) plus a fixed set of primitives, arrays, and well-known compiler types. Any other class hits the terminal 'No serializer for <class>: <value>' IllegalArgumentException.","triggerScenarios":"Recording a compilation whose inputs/results reference a type not covered by CompilerInterfaceDeclarations registrations or the codec's hardcoded switch cases; adding a new field to a recorded compiler object whose type is unregistered.","commonSituations":"Extending the compiler with new value types that flow into recorded compilation state without registering them; replay support lagging behind a new feature that introduces novel object types.","solutions":["Register the offending class (and its supertype mapping) with CompilerInterfaceDeclarations so the codec can emit REGISTERED_* tags for it","If the type is under your control, add an explicit TAG case to writeValue/readValue in the codec","Serialize the offending data as a simpler representable form (String, primitive, or registered wrapper) before it reaches the copier"],"exampleFix":"// before\nObject value = new MyCustomType(); // not registered\nwriteValue(out, value, state); // -> No serializer for ...\n\n// after\n// register the type so the codec recognizes it\ndeclarations.register(MyCustomType.class, /* singleton= */ false);\nwriteValue(out, value, state); // emits REGISTERED_INSTANCE_TAG","handlingStrategy":"validation","validationCode":"boolean serializable(Object v, CompilerInterfaceDeclarations d) {\n    if (v == null || v instanceof String || v instanceof Number || v instanceof Boolean || v.getClass().isArray()) return true;\n    return d.findRegistration(v.getClass()) != null;\n}","typeGuard":null,"tryCatchPattern":"try {\n    codec.writeValues(values);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"No serializer for\")) {\n        throw new IllegalStateException(\"Unregistered type in recorded state: \" + e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Register every custom type that can flow into recorded compilation state with CompilerInterfaceDeclarations before constructing the codec","Add a smoke-test that round-trips (write then read) a recorded compilation to catch unregistered types early"],"tags":["graalvm","replay-compilation","serialization","registration","codec"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}