NationalSecurityAgency/ghidra · error · DuplicateNameException
Overlay space '${name}' duplicates name of another address s
Error message
Overlay space '${name}' duplicates name of another address space What it means
In doCreateOverlaySpace, before creating, the code checks factory.getAddressSpace(name) != null and throws DuplicateNameException("Overlay space 'name' duplicates name of another address space") on collision. The chosen overlay name must not match any existing address space in the trace's address factory (overlay or built-in).
Source
Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/address/DBTraceOverlaySpaceAdapter.java:260
AddressSpace baseSpace = factory.getAddressSpace(ent.baseSpace);
if (baseSpace == null) {
// Error condition should be handled better - language may have dropped original base space
throw new RuntimeException("Base space for overlay not found: " + ent.baseSpace);
}
return baseSpace == os.getOverlayedSpace();
}
protected AddressSpace doCreateOverlaySpace(String name, AddressSpace base)
throws DuplicateNameException {
TraceAddressFactory factory = trace.getInternalAddressFactory();
if (!factory.isValidOverlayBaseSpace(base)) {
throw new IllegalArgumentException(
"Invalid address space for overlay: " + base.getName());
}
if (factory.getAddressSpace(name) != null) {
throw new DuplicateNameException(
"Overlay space '" + name + "' duplicates name of another address space");
}
DBTraceOverlaySpaceEntry ent = overlayStore.create();
ProgramOverlayAddressSpace space = factory.addOverlaySpace(ent.getKey(), name, base);
// Only if it succeeds do we store the record
ent.set(space.getName(), base.getName());
trace.updateViewsAddSpaceBlock(space);
trace.setChanged(
new TraceChangeRecord<>(TraceEvents.OVERLAY_ADDED, space, trace, null, space));
return space;
}
public AddressSpace createOverlayAddressSpace(String name, AddressSpace base)
throws DuplicateNameException {
// TODO: Exclusive lock?
try (LockHold hold = LockHold.lock(lock.writeLock())) {View on GitHub (pinned to d5f144c24d)
Solutions
- Use getOrCreateOverlayAddressSpace when idempotency is desired.
- Check factory.getAddressSpace(name) == null before calling create.
- Generate a unique name (append a suffix/counter) on collision.
Example fix
// before
trace.createOverlayAddressSpace("ext", base);
// after
String name = "ext";
while (factory.getAddressSpace(name) != null) {
name = name + "_";
}
trace.createOverlayAddressSpace(name, base); Defensive patterns
Strategy: try-catch
Validate before calling
if (factory.getAddressSpace(name) != null) {
// name taken; pick another or use getOrCreate
} Try / catch
try { trace.createOverlayAddressSpace(name, base); }
catch (DuplicateNameException e) { /* choose unique name and retry */ } Prevention
- Prefer getOrCreateOverlayAddressSpace for idempotent setup.
- Generate names with a counter/suffix scheme to avoid collisions.
- Check the address factory for the name before any create call.
When it happens
Trigger: Creating an overlay whose name matches an existing overlay or built-in space; re-running creation code that does not deduplicate; importing content that already defined the space.
Common situations: Programmatic overlay creation with duplicate or generated names that clash; names like "External" or any built-in space name; re-running setup scripts against an already-populated trace.
Related errors
- Address space ${name} already exists.
- Invalid address space for overlay: {}
- Invalid number of elements specified: {}
- pos cannot be less than zero
- %s: unknown demangling style `%s'
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/e0624325e0b65764.
Report an issue: GitHub.