NationalSecurityAgency/ghidra · error · IllegalArgumentException
Invalid register name: {}
Error message
Invalid register name: {} What it means
Thrown by FlatDebuggerAPI.validateRegisterName(language, name) when the single supplied register name does not exist in the given language. This is the single-name counterpart to the bulk validator.
Source
Thrown at Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.java:1077
}
if (!invalid.isEmpty()) {
throw new IllegalArgumentException("One or more invalid register names: " + invalid);
}
return result;
}
/**
* Validate and retrieve the name register
*
* @param language the language defining the register
* @param name the name
* @return the register
* @throws IllegalArgumentException if the name is invalid
*/
default Register validateRegisterName(Language language, String name) {
Register register = language.getRegister(name);
if (register == null) {
throw new IllegalArgumentException("Invalid register name: " + name);
}
return register;
}
/**
* Read several registers from the current context, refreshing from the target if needed
*
* @param names the source register names
* @return the list of register values, or null on error
* @throws IllegalArgumentException if any name is invalid
* @see #readRegisters(TracePlatform, TraceThread, int, long, Collection)
*/
default List<RegisterValue> readRegistersNamed(Collection<String> names) {
return readRegisters(validateRegisterNames(requireCurrentTrace().getBaseLanguage(), names));
}
/**
* Read a register from the current context, refreshing from the target if neededView on GitHub (pinned to d5f144c24d)
Solutions
- Check language.getRegister(name) != null before calling validateRegisterName().
- Use language.getRegister(name) directly instead of the validator if you just need the register.
- Confirm the register name is correct for the platform's architecture.
Example fix
// before
Register r = validateRegisterName(lang, "r15x"); // typo, throws
// after
String name = "r15";
if (lang.getRegister(name) == null) {
println("Unknown register: " + name);
return;
}
Register r = validateRegisterName(lang, name); Defensive patterns
Strategy: validation
Validate before calling
if (language.getRegister(name) == null) {
println("Unknown register: " + name);
return;
} Type guard
static boolean isValidRegisterName(Language lang, String name) {
return lang.getRegister(name) != null;
} Try / catch
try {
Register r = validateRegisterName(lang, name);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Invalid register name")) {
// list valid registers for the user, then retry
} else throw e;
} Prevention
- Pre-check with language.getRegister(name) before calling the validator.
- Confirm the register name belongs to the current architecture.
When it happens
Trigger: Calling validateRegisterName(lang, name) where language.getRegister(name) returns null.
Common situations: Architecture mismatch (register name from a different ISA); typo in the register name; the register is not exposed by this particular language definition.
Related errors
- One or more invalid register names: {}
- Register {} is not in language {}
- length < 0
- Given platform is not from the current trace
- Missing required parameter '%s' (%s)
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/bc1b427a4300851a.
Report an issue: GitHub.