oracle/graal · error · IllegalArgumentException
No serializer registered for the given tag ${tag}
Error message
No serializer registered for the given tag ${tag} What it means
RecursiveSerializer.serialize(Object, ValueBuilder, String tag) is the tag-directed variant used for top-level entries such as the compilation unit: it looks up tagSerializers by the caller-supplied tag. IllegalArgumentException('No serializer registered for the given tag ...') means the codec instance has no serializer registered under that tag string.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/JsonReplayCodec.java:1917
if (serializer == null) {
throw new IllegalArgumentException("No serializer for " + instance.getClass() + ": " + instance);
}
}
try (JsonBuilder.ObjectBuilder builder = valueBuilder.object()) {
builder.append("tag", serializer.tag());
serializer.serialize(instance, builder, this);
}
}
@Override
public void serialize(Object instance, JsonBuilder.ValueBuilder valueBuilder, String tag) throws IOException {
if (instance == null) {
valueBuilder.value(null);
return;
}
ObjectSerializer serializer = tagSerializers.get(tag);
if (serializer == null) {
throw new IllegalArgumentException("No serializer registered for the given tag " + tag);
}
try (JsonBuilder.ObjectBuilder builder = valueBuilder.object()) {
serializer.serialize(instance, builder, this);
}
}
};
/**
* Writes a recorded compilation unit in JSON replay format.
*
* @param compilationUnit the compilation unit to encode
* @param writer the destination writer
* @throws IOException if encoding fails
*/
public void dump(RecordedCompilationUnit compilationUnit, JsonWriter writer) throws IOException {
recursiveSerializer.serialize(compilationUnit, writer.valueBuilder(), RecordedCompilationUnitSerializer.TAG);
}
View on GitHub (pinned to a66e9ccd1d)
Solutions
- Verify the tag string matches a registered serializer's tag() return value exactly
- Register the missing serializer in the codec's tagSerializers map before serializing
- Use the codec's public write entry point rather than calling the internal tagged serialize directly
Defensive patterns
Strategy: validation
Validate before calling
// Before the tagged serialize call
if (!codec.hasSerializerForTag(tag)) { // or expose tagSerializers
throw new IllegalArgumentException("No serializer for tag " + tag + "; register one first");
} Prevention
- Prefer the codec's public write() entry point over calling the internal tagged serializer directly
- When adding a top-level entry type, register its serializer before any write
When it happens
Trigger: Calling serialize(instance, valueBuilder, tag) with a tag that was never registered — e.g. RecordedCompilationUnitSerializer.TAG on a codec built without that serializer, or a typo'd/custom tag.
Common situations: Constructing a reduced JsonReplayCodec (subset of serializers) but serializing the full compilation unit; version drift renaming tags; custom code adding new top-level entry types without registering them.
Related errors
- Invalid replay string table index
- Invalid replay string definition index
- Invalid replay symbolic method index
- Invalid replay symbolic method definition index
- Invalid replay registration index
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/92afbe82e09c8b16.
Report an issue: GitHub.