NationalSecurityAgency/ghidra · error · IllegalStateException
Must fetch
Error message
Must fetch
What it means
TraceRegisterUtils.combineWithTraceParentRegisterValue needs the parent register's value from the trace's memory space. When regs (TraceMemorySpace) is null and requireKnown is true, there is no register space to read the parent value from, so the combination cannot proceed safely. The method requires the parent's current value to be available before setting a sub-register.
Source
Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/util/TraceRegisterUtils.java:247
return new RegisterValue(register, value);
}
Address addr = data.getTrace().getBaseAddressFactory().getAddress(representation);
if (addr == null) {
throw new DataTypeEncodeException("Invalid address", representation, dataType);
}
return new RegisterValue(register, addr.getOffsetAsBigInteger());
}
public static RegisterValue combineWithTraceParentRegisterValue(Register parent,
RegisterValue rv, TracePlatform platform, long snap, TraceMemorySpace regs,
boolean requireKnown) {
Register reg = rv.getRegister();
if (reg == parent) {
return rv;
}
if (regs == null) {
if (requireKnown) {
throw new IllegalStateException("Must fetch " + parent + " before setting " + reg);
}
return rv.getRegisterValue(parent);
}
if (requireKnown) {
if (TraceMemoryState.KNOWN != regs.getState(platform, snap, parent)) {
throw new IllegalStateException("Must fetch " + parent + " before setting " + reg);
}
}
return regs.getValue(platform, snap, parent).combineValues(rv);
}
public static RegisterValue combineWithTraceBaseRegisterValue(RegisterValue rv,
TracePlatform platform, long snap, TraceMemorySpace regs, boolean requireKnown) {
return combineWithTraceParentRegisterValue(rv.getRegister().getBaseRegister(), rv, platform,
snap, regs, requireKnown);
}
public static ByteBuffer prepareBuffer(Register register) {View on GitHub (pinned to d5f144c24d)
Solutions
- Pass requireKnown=false if you don't need the parent value to be in KNOWN state
- Ensure the TraceMemorySpace for the thread/frame exists: obtain it via trace.getMemoryManager().getMemorySpace(threadKey, true) before calling
- Fetch/set the parent register first to create the register space state
- If no register space is available, use rv.getRegisterValue(parent) with requireKnown=false
Example fix
// before
RegisterValue combined = TraceRegisterUtils.combineWithTraceParentRegisterValue(
parent, rv, platform, snap, null, true); // regs is null
// after
TraceMemorySpace regs = trace.getMemoryManager()
.getRegisterSpace(threadKey, frameLevel, true);
RegisterValue combined = TraceRegisterUtils.combineWithTraceParentRegisterValue(
parent, rv, platform, snap, regs, true); Defensive patterns
Strategy: validation
Validate before calling
boolean canCombineWithParent(TraceMemorySpace regs, boolean requireKnown) {
if (requireKnown && regs == null) return false;
return true;
} Type guard
// N/A
Try / catch
// IllegalStateException; validate preconditions before calling
Prevention
- Ensure TraceMemorySpace is non-null before requiring known state
- Obtain the register space with getRegisterSpace(threadKey, frameLevel, true) before combining
- Pass requireKnown=false when the parent state is not guaranteed
When it happens
Trigger: Calling combineWithTraceParentRegisterValue where the TraceMemorySpace regs parameter is null and requireKnown=true. This happens when the caller has no register space handle (e.g. operating on a platform/frame without a memory space) but asks for known-state combination.
Common situations: Setting a sub-register (e.g. AL within EAX) before the trace has a register space for that thread/frame. Operating on a snapshot or thread where register memory space was never created. Using requireKnown=true in a context where the trace is still being set up and register state hasn't been initialized.
Related errors
- Cannot work with sub-byte registers. Consider a parent inste
- More than one state is present in
- Arrays must be the same length
- Invalid address
- Could not find a register for
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/8be0d9114a739095.
Report an issue: GitHub.