{"record":{"id":"c93763f6e15e4946","repo":"NationalSecurityAgency/ghidra","slug":"address-is-not-in-this-space","errorCode":null,"errorMessage":"Address '{}' is not in this space: '{}'","messagePattern":"Address '(.+?)' is not in this space: '(.+?)'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/space/DBTraceSpaceBased.java","lineNumber":49,"sourceCode":"\t\t * will all be delegated from the manger directly, it doesn't make sense to permit sloppy\n\t\t * access.\n\t\t */\n\t\t/*if (space.isRegisterSpace() && space == getAddressSpace().getPhysicalSpace()) {\n\t\t\treturn true;\n\t\t}*/\n\t\treturn false;\n\t}\n\n\tdefault String explainLanguages(AddressSpace space) {\n\t\tif (space.getName().equals(getAddressSpace().getName())) {\n\t\t\treturn \". It's likely they come from different languages. Check the platform.\";\n\t\t}\n\t\treturn \"\";\n\t}\n\n\tdefault long assertInSpace(Address addr) {\n\t\tif (!isMySpace(addr.getAddressSpace())) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"Address '\" + addr + \"' is not in this space: '\" + getAddressSpace() + \"'\" +\n\t\t\t\t\texplainLanguages(addr.getAddressSpace()));\n\t\t}\n\t\treturn addr.getOffset();\n\t}\n\n\tdefault void assertInSpace(AddressRange range) {\n\t\tif (!isMySpace(range.getAddressSpace())) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"Address Range '\" + range + \"' is not in this space: '\" + getAddressSpace() + \"'\" +\n\t\t\t\t\texplainLanguages(range.getAddressSpace()));\n\t\t}\n\t}\n\n\tdefault Address toOverlay(Address physical) {\n\t\treturn getAddressSpace().getOverlayAddress(physical);\n\t}\n","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/space/DBTraceSpaceBased.java#L31-L67","documentation":"Thrown by DBTraceSpaceBased.assertInSpace(Address) when the address's address space does not match this space object's address space (checked via isMySpace). The optional suffix explainLanguages() appends a hint when the space names match, suggesting the addresses come from different languages/platforms. This guards every per-space operation from cross-space address contamination.","triggerScenarios":"Passing an address from the host language's memory space into a per-space object that was created for a guest platform's memory space (different language, same nominal name). Passing a register address into a memory-space object.","commonSituations":"Multi-platform/guest debugging where memory spaces share names but differ by language; copying addresses between trace views backed by different platforms.","solutions":["Translate the address to the target space via toOverlay(physical) or space.getAddress(offset).","Ensure you are operating on the space object whose getAddressSpace() matches addr.getAddressSpace().","Verify the platform/language before reusing cached addresses."],"exampleFix":"// before\nspaceObj.put(snap, hostAddr, ...);\n// after\nAddress translated = spaceObj.toOverlay(hostAddr.getPhysicalAddress());\nspaceObj.put(snap, translated, ...);","handlingStrategy":"validation","validationCode":"if (!spaceObj.isMySpace(addr.getAddressSpace())) {\n    addr = spaceObj.toOverlay(addr.getPhysicalAddress());\n}\nspaceObj.assertInSpace(addr);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Translate addresses to the target space via toOverlay before per-space calls.","Confirm platform/language match before reusing cached addresses."],"tags":["address-space","validation","platform"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}