{"record":{"id":"c8a258e8ae716158","repo":"oracle/graal","slug":"unknown-replay-tag","errorCode":null,"errorMessage":"Unknown replay tag ","messagePattern":"Unknown replay tag ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java","lineNumber":1017,"sourceCode":"            }\n            case ARCHITECTURE_TAG -> {\n                Architecture architecture = readArchitecture(in);\n                state.setArchitecture(architecture);\n                yield architecture;\n            }\n            case TARGET_DESCRIPTION_TAG ->\n                new TargetDescription((Architecture) readValue(in, state), readBooleanFlag(in), in.readPackedSignedInt(), in.readPackedSignedInt(), readBooleanFlag(in));\n            case REGISTER_CONFIG_TAG -> readRegisterConfig(in, state);\n            case EXCEPTION_HANDLER_TAG ->\n                new ExceptionHandler(in.readPackedSignedInt(), in.readPackedSignedInt(), in.readPackedSignedInt(), in.readPackedSignedInt(), (JavaType) readValue(in, state));\n            case THROWABLE_TAG ->\n                createThrowable(requireNonNullString(readStringReference(in, state), \"throwable class\"), readStringReference(in, state));\n            case COMPILATION_TASK_EXCEPTION_TAG ->\n                new CompilationTaskProduct.CompilationTaskException(requireNonNullString(readStringReference(in, state), \"task exception class\"),\n                                requireNonNullString(readStringReference(in, state), \"task exception stack trace\"));\n            case RECORDED_TASK_ARTIFACTS_TAG ->\n                new CompilationTaskProduct.RecordedCompilationTaskArtifacts(requireNonNullString(readStringReference(in, state), \"final graph\"));\n            default -> throw new IOException(\"Unknown replay tag \" + tag);\n        };\n    }\n\n    private static void writeProperties(ObjectCopierOutputStream out, Map<String, String> properties, WriteState state) throws IOException {\n        if (properties == null) {\n            out.writePackedUnsignedInt(0);\n            return;\n        }\n        out.writePackedUnsignedInt(properties.size() + 1);\n        for (Map.Entry<String, String> entry : properties.entrySet()) {\n            writeStringReference(out, entry.getKey(), state);\n            writeStringReference(out, entry.getValue(), state);\n        }\n    }\n\n    private static Map<String, String> readProperties(ObjectCopierInputStream in, ReadState state) throws IOException {\n        int encodedSize = in.readPackedUnsignedInt();\n        if (encodedSize == 0) {","sourceCodeStart":999,"sourceCodeEnd":1035,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java#L999-L1035","documentation":"The terminal default of readValue's top-level tag switch: the first byte read for a value is a tag the codec does not recognize, so it throws IOException 'Unknown replay tag <tag>'. Because every subsequent parse is positioned off this tag byte, an unknown tag means the reader and writer disagree on the format or the stream is misaligned/corrupt.","triggerScenarios":"Replaying a binary written by a codec version with extra tags; any earlier parse error left the cursor misaligned, so the next tag byte is arbitrary data; truncated files where reads return garbage.","commonSituations":"Replay file version mismatch (writer newer than reader); corrupted or partially-written replay files (process killed mid-write); introducing new tags without bumping the file VERSION.","solutions":["Regenerate the replay file with the exact GraalVM build used for replay","Check the file version via verifyHeader passes before full decode","If adding new tags in a fork, bump VERSION so older readers reject the file up front instead of mid-stream"],"exampleFix":"// before\ndefault -> throw new IOException(\"Unknown replay tag \" + tag);\n\n// after\n// prevention: gate on the version read in verifyHeader\nint version = readVersion(file);\nif (version != VERSION) throw new IOException(\"Unsupported replay file version \" + version);","handlingStrategy":"validation","validationCode":"// cheap structural pre-check before full decode\nstatic boolean looksLikeReplayFile(java.nio.file.Path p) throws IOException {\n    byte[] magic = java.nio.file.Files.readAllBytes(p);\n    return magic.length > 0 && magic[0] == BinaryReplayCodec.MAGIC[0];\n}","typeGuard":null,"tryCatchPattern":"try {\n    result = codec.readReplay(in);\n} catch (IOException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Unknown replay tag\")) {\n        // treat as corrupt or version-skewed file; discard and re-record\n    } else throw e;\n}","preventionTips":["Verify MAGIC and version header before parsing the body","Bump VERSION on every tag-set change so unknown tags never reach production readers"],"tags":["graalvm","replay-compilation","deserialization","corruption","version-skew"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}