NationalSecurityAgency/ghidra · error · NoSuchElementException
${name}
Error message
${name} What it means
deleteOverlayAddressSpace looks up the overlay by name via overlaysByName.getOne(name); if no entry exists it throws NoSuchElementException(name) (the message is just the name). The caller asked to delete an overlay that was never created, was already removed, or whose name is mistyped.
Source
Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/address/DBTraceOverlaySpaceAdapter.java:309
AddressSpace space = factory.getAddressSpace(name);
if (space != null) {
return space.getPhysicalSpace() == base ? space : null;
}
try {
return doCreateOverlaySpace(name, base);
}
catch (DuplicateNameException e) {
throw new AssertionError(e);
}
}
}
public void deleteOverlayAddressSpace(String name) {
// TODO: Exclusive lock?
try (LockHold hold = LockHold.lock(lock.writeLock())) {
DBTraceOverlaySpaceEntry exists = overlaysByName.getOne(name);
if (exists == null) {
throw new NoSuchElementException(name);
}
overlayStore.delete(exists);
TraceAddressFactory factory = trace.getInternalAddressFactory();
AddressSpace space = factory.getAddressSpace(name);
assert space != null;
factory.removeOverlaySpace(name);
trace.updateViewsDeleteSpaceBlock(space);
trace.setChanged(
new TraceChangeRecord<>(TraceEvents.OVERLAY_DELETED, space, trace, space, null));
invalidateCache(true);
}
}
}
View on GitHub (pinned to d5f144c24d)
Solutions
- Check existence first: confirm factory.getAddressSpace(name) is an overlay / overlaysByName contains the name.
- Use getOrCreate-style idempotent delete: look up getOne(name) and no-op when null.
- Catch NoSuchElementException and treat as already-removed.
Example fix
// before
trace.deleteOverlayAddressSpace(name);
// after
if (factory.getAddressSpace(name) != null) {
trace.deleteOverlayAddressSpace(name);
} Defensive patterns
Strategy: validation
Validate before calling
if (factory.getAddressSpace(name) instanceof ProgramOverlayAddressSpace) {
trace.deleteOverlayAddressSpace(name);
} Try / catch
try { trace.deleteOverlayAddressSpace(name); }
catch (NoSuchElementException e) { /* already gone; no-op */ } Prevention
- Make delete operations idempotent by checking existence first.
- Disable UI delete controls for non-overlay spaces.
- Normalize names (trim/case) before lookup to avoid typos.
When it happens
Trigger: Calling deleteOverlayAddressSpace(name) for a name not present in the overlay table; double-deleting; passing a name with wrong case/whitespace; deleting a space that is not actually an overlay.
Common situations: UI delete actions re-firing; cleanup code assuming an overlay exists; mismatches between stored and displayed names.
Related errors
- Cannot emulate a trace unless it's opened in the tool.
- Static program is not opened
- Trace is not opened in this tool
- Trace must be opened before activated: {}
- The program containing the frame's function is unavailable,
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/98ef24ccfedffe2c.
Report an issue: GitHub.