{"record":{"id":"5a20735a52a67e2b","repo":"oracle/graal","slug":"register-number-not-found-in-architecturename","errorCode":null,"errorMessage":"Register ${number} not found in ${architectureName}","messagePattern":"Register (.+?) not found in (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java","lineNumber":1117,"sourceCode":"        Class<?> componentType = array.getClass().getComponentType();\n        Class<?> registeredSupertype = declarations.findRegisteredSupertype(componentType);\n        return (registeredSupertype != null) ? registeredSupertype : componentType;\n    }\n\n    private static String requireNonNullString(String value, String description) throws IOException {\n        if (value == null) {\n            throw new IOException(\"Required replay field \" + description + \" is null\");\n        }\n        return value;\n    }\n\n    private static Register findRegister(Architecture architecture, int number) throws IOException {\n        for (Register register : architecture.getRegisters()) {\n            if (register.number == number) {\n                return register;\n            }\n        }\n        throw new IOException(\"Register \" + number + \" not found in \" + architecture.getName());\n    }\n\n    private static Throwable createThrowable(String className, String message) {\n        if (className.equals(JVMCIError.class.getName())) {\n            return new JVMCIError(message);\n        } else if (className.equals(GraalError.class.getName())) {\n            return new GraalError(message);\n        } else if (className.equals(IllegalArgumentException.class.getName())) {\n            return new IllegalArgumentException(message);\n        } else {\n            return new Throwable(message);\n        }\n    }\n\n    private static int architectureKind(Architecture architecture) {\n        return switch (architecture) {\n            case AMD64 ignored -> AMD64_ARCHITECTURE;\n            case RISCV64 ignored -> RISCV64_ARCHITECTURE;","sourceCodeStart":1099,"sourceCodeEnd":1135,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java#L1099-L1135","documentation":"When decoding a REGISTER_TAG, findRegister scans architecture.getRegisters() for a register whose number equals the encoded value; no match throws IOException 'Register <number> not found in <arch name>'. The recording environment's register file contains a register number the replaying architecture object does not define.","triggerScenarios":"Replaying a file recorded on one target/architecture configuration whose register set differs from the replaying one; a corrupted packed-int register number.","commonSituations":"Cross-architecture replay (recording on AMD64, replaying with an AArch64 target description); GraalVM/JDK builds whose register definitions changed; version skew in the register configuration encoding.","solutions":["Replay on the same architecture as the recording (matching TargetDescription/Architecture)","Re-record the replay file with the same build and target configuration","Verify the architecture kind matches before decoding registers"],"exampleFix":"// before\nRegister r = findRegister(state.registerArchitecture(), num); // may throw\n\n// after\nboolean known = Arrays.stream(arch.getRegisters()).anyMatch(reg -> reg.number == num);\nif (!known) throw new IOException(\"Register \" + num + \" not present; re-record on matching architecture\");","handlingStrategy":"validation","validationCode":"static boolean registerNumberDefined(Architecture arch, int number) {\n    for (Register r : arch.getRegisters()) if (r.number == number) return true;\n    return false;\n}","typeGuard":null,"tryCatchPattern":"try {\n    result = codec.readReplay(in);\n} catch (IOException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Register \") && e.getMessage().contains(\"not found in\")) {\n        // architecture/register-file mismatch: replay on the recording architecture\n    } else throw e;\n}","preventionTips":["Record and replay on the same target architecture","Keep the GraalVM build identical on both sides so register definitions match"],"tags":["graalvm","replay-compilation","registers","architecture-mismatch","deserialization"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}