oracle/graal · error · IOException

Register ${number} not found in ${architectureName}

Error message

Register ${number} not found in ${architectureName}

What it means

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.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java:1117

        Class<?> componentType = array.getClass().getComponentType();
        Class<?> registeredSupertype = declarations.findRegisteredSupertype(componentType);
        return (registeredSupertype != null) ? registeredSupertype : componentType;
    }

    private static String requireNonNullString(String value, String description) throws IOException {
        if (value == null) {
            throw new IOException("Required replay field " + description + " is null");
        }
        return value;
    }

    private static Register findRegister(Architecture architecture, int number) throws IOException {
        for (Register register : architecture.getRegisters()) {
            if (register.number == number) {
                return register;
            }
        }
        throw new IOException("Register " + number + " not found in " + architecture.getName());
    }

    private static Throwable createThrowable(String className, String message) {
        if (className.equals(JVMCIError.class.getName())) {
            return new JVMCIError(message);
        } else if (className.equals(GraalError.class.getName())) {
            return new GraalError(message);
        } else if (className.equals(IllegalArgumentException.class.getName())) {
            return new IllegalArgumentException(message);
        } else {
            return new Throwable(message);
        }
    }

    private static int architectureKind(Architecture architecture) {
        return switch (architecture) {
            case AMD64 ignored -> AMD64_ARCHITECTURE;
            case RISCV64 ignored -> RISCV64_ARCHITECTURE;

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Replay on the same architecture as the recording (matching TargetDescription/Architecture)
  2. Re-record the replay file with the same build and target configuration
  3. Verify the architecture kind matches before decoding registers

Example fix

// before
Register r = findRegister(state.registerArchitecture(), num); // may throw

// after
boolean known = Arrays.stream(arch.getRegisters()).anyMatch(reg -> reg.number == num);
if (!known) throw new IOException("Register " + num + " not present; re-record on matching architecture");
Defensive patterns

Strategy: validation

Validate before calling

static boolean registerNumberDefined(Architecture arch, int number) {
    for (Register r : arch.getRegisters()) if (r.number == number) return true;
    return false;
}

Try / catch

try {
    result = codec.readReplay(in);
} catch (IOException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Register ") && e.getMessage().contains("not found in")) {
        // architecture/register-file mismatch: replay on the recording architecture
    } else throw e;
}

Prevention

When it happens

Trigger: Replaying a file recorded on one target/architecture configuration whose register set differs from the replaying one; a corrupted packed-int register number.

Common situations: 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.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/5a20735a52a67e2b. Report an issue: GitHub.