{"record":{"id":"98ef24ccfedffe2c","repo":"NationalSecurityAgency/ghidra","slug":"name","errorCode":null,"errorMessage":"${name}","messagePattern":"\\$\\{name\\}","errorType":"validation","errorClass":"NoSuchElementException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/address/DBTraceOverlaySpaceAdapter.java","lineNumber":309,"sourceCode":"\t\t\tAddressSpace space = factory.getAddressSpace(name);\n\t\t\tif (space != null) {\n\t\t\t\treturn space.getPhysicalSpace() == base ? space : null;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn doCreateOverlaySpace(name, base);\n\t\t\t}\n\t\t\tcatch (DuplicateNameException e) {\n\t\t\t\tthrow new AssertionError(e);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic void deleteOverlayAddressSpace(String name) {\n\t\t// TODO: Exclusive lock?\n\t\ttry (LockHold hold = LockHold.lock(lock.writeLock())) {\n\t\t\tDBTraceOverlaySpaceEntry exists = overlaysByName.getOne(name);\n\t\t\tif (exists == null) {\n\t\t\t\tthrow new NoSuchElementException(name);\n\t\t\t}\n\t\t\toverlayStore.delete(exists);\n\t\t\tTraceAddressFactory factory = trace.getInternalAddressFactory();\n\t\t\tAddressSpace space = factory.getAddressSpace(name);\n\t\t\tassert space != null;\n\t\t\tfactory.removeOverlaySpace(name);\n\t\t\ttrace.updateViewsDeleteSpaceBlock(space);\n\t\t\ttrace.setChanged(\n\t\t\t\tnew TraceChangeRecord<>(TraceEvents.OVERLAY_DELETED, space, trace, space, null));\n\t\t\tinvalidateCache(true);\n\t\t}\n\t}\n\n}\n","sourceCodeStart":291,"sourceCodeEnd":324,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/address/DBTraceOverlaySpaceAdapter.java#L291-L324","documentation":"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.","triggerScenarios":"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.","commonSituations":"UI delete actions re-firing; cleanup code assuming an overlay exists; mismatches between stored and displayed names.","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."],"exampleFix":"// before\ntrace.deleteOverlayAddressSpace(name);\n\n// after\nif (factory.getAddressSpace(name) != null) {\n    trace.deleteOverlayAddressSpace(name);\n}","handlingStrategy":"validation","validationCode":"if (factory.getAddressSpace(name) instanceof ProgramOverlayAddressSpace) {\n    trace.deleteOverlayAddressSpace(name);\n}","typeGuard":null,"tryCatchPattern":"try { trace.deleteOverlayAddressSpace(name); }\ncatch (NoSuchElementException e) { /* already gone; no-op */ }","preventionTips":["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."],"tags":["overlay","not-found","lifecycle"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}