{"record":{"id":"6f174b7a65e7744b","repo":"oracle/graal","slug":"the-replay-map-does-not-contain-a-tag-map","errorCode":null,"errorMessage":"The replay map does not contain a tag: ${map}","messagePattern":"The replay map does not contain a tag: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/JsonReplayCodec.java","lineNumber":1945,"sourceCode":"     *\n     * @param compilationUnit the compilation unit to encode\n     * @param writer the destination writer\n     * @throws IOException if encoding fails\n     */\n    public void dump(RecordedCompilationUnit compilationUnit, JsonWriter writer) throws IOException {\n        recursiveSerializer.serialize(compilationUnit, writer.valueBuilder(), RecordedCompilationUnitSerializer.TAG);\n    }\n\n    private RecursiveDeserializer createRecursiveDeserializer() {\n        return new RecursiveDeserializer() {\n            @Override\n            @SuppressWarnings(\"unchecked\")\n            public Object deserialize(Object json, CompilationProxies.ProxyFactory proxyFactory) throws DeserializationException {\n                if (json instanceof EconomicMap<?, ?>) {\n                    EconomicMap<String, Object> map = (EconomicMap<String, Object>) json;\n                    String tag = (String) map.get(\"tag\");\n                    if (tag == null) {\n                        throw new IllegalArgumentException(\"The replay map does not contain a tag: \" + map);\n                    }\n                    ObjectSerializer deserializer = tagSerializers.get(tag);\n                    if (deserializer == null) {\n                        throw new IllegalArgumentException(\"No deserializer registered for tag \" + tag);\n                    }\n                    return deserializer.deserialize(map, this, proxyFactory);\n                } else {\n                    return json;\n                }\n            }\n\n            @Override\n            @SuppressWarnings(\"unchecked\")\n            public Object deserialize(Object json, CompilationProxies.ProxyFactory proxyFactory, String tag) throws DeserializationException {\n                if (json instanceof EconomicMap<?, ?>) {\n                    EconomicMap<String, Object> map = (EconomicMap<String, Object>) json;\n                    ObjectSerializer deserializer = tagSerializers.get(tag);\n                    if (deserializer == null) {","sourceCodeStart":1927,"sourceCodeEnd":1963,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/JsonReplayCodec.java#L1927-L1963","documentation":"During deserialization, every JSON object in a replay file must carry a 'tag' string identifying its type; the RecursiveDeserializer reads map.get(\"tag\") to dispatch. IllegalArgumentException('The replay map does not contain a tag: ...') fires when an EconomicMap node lacks the tag key entirely.","triggerScenarios":"Replaying JSON where an object node has no 'tag' field — hand-written or transformed JSON, a file produced by a different/older codec version, or a JSON→map parser that drops keys (e.g. malformed nesting).","commonSituations":"Manual authoring of replay files; converting replay JSON through tools that lose fields; version skew between writer and reader formats.","solutions":["Locate the tag-less object via the map dump in the message and add the correct 'tag' field","Re-generate the file with the same codec that reads it (use the codec's write API)","Validate the file's schema before replay: every object node must have a 'tag'"],"exampleFix":"// before: { \"number\": 7 }  // no tag\n// after:   { \"tag\": \"register\", \"number\": 7 }","handlingStrategy":"validation","validationCode":"// Schema pre-check: every object node in the replay JSON must carry a 'tag'\nvoid validateTags(Object node) {\n    if (node instanceof EconomicMap<?,?> m) {\n        if (m.get(\"tag\") == null) throw new IllegalArgumentException(\"Missing tag: \" + m);\n        m.values().forEach(this::validateTags);\n    } else if (node instanceof List<?> l) {\n        l.forEach(this::validateTags);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only produce replay JSON through the codec; never hand-write object nodes","Add a validation pass over the parsed JSON before handing it to the deserializer"],"tags":["graalvm","replay","deserialization","json"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}