{"record":{"id":"1cb699467f58e997","repo":"NationalSecurityAgency/ghidra","slug":"address-address-is-not-in-process-proc-1cb699","errorCode":null,"errorMessage":"Address {address} is not in process {proc}","messagePattern":"Address (.+?) is not in process (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-x64dbg/src/main/py/src/ghidraxdbg/arch.py","lineNumber":155,"sourceCode":"def compute_ghidra_lcsp() -> Tuple[str, str]:\n    lang = compute_ghidra_language()\n    comp = compute_ghidra_compiler(lang)\n    return lang, comp\n\n\nclass DefaultMemoryMapper(object):\n\n    def __init__(self, defaultSpace: str) -> None:\n        self.defaultSpace = defaultSpace\n\n    def map(self, proc: int, offset: int) -> Tuple[str, Address]:\n        space = self.defaultSpace\n        return self.defaultSpace, Address(space, offset)\n\n    def map_back(self, proc: int, address: Address) -> int:\n        if address.space == self.defaultSpace:\n            return address.offset\n        raise ValueError(f\"Address {address} is not in process {proc}\")\n\n\nDEFAULT_MEMORY_MAPPER = DefaultMemoryMapper('ram')\n\nmemory_mappers: Dict[str, DefaultMemoryMapper] = {}\n\n\ndef compute_memory_mapper(lang: str) -> DefaultMemoryMapper:\n    if not lang in memory_mappers:\n        return DEFAULT_MEMORY_MAPPER\n    return memory_mappers[lang]\n\n\nclass DefaultRegisterMapper(object):\n\n    def __init__(self, byte_order: str) -> None:\n        if not byte_order in ['big', 'little']:\n            raise ValueError(\"Invalid byte_order: {}\".format(byte_order))","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-x64dbg/src/main/py/src/ghidraxdbg/arch.py#L137-L173","documentation":"Raised by DefaultMemoryMapper.map_back when the Address's space attribute does not equal the mapper's configured defaultSpace (typically 'ram'). The default x64dbg memory mapper is a simple identity mapper: it maps offsets directly to the single default address space and rejects any address from a different space.","triggerScenarios":"map_back(proc, address) is called during write_mem or memory operations. The Address object's .space field is not 'ram' (or whatever defaultSpace was configured), so the guard triggers.","commonSituations":"A multi-space address (e.g. from a Ghidra language with separate code/data spaces) was passed to the default identity mapper. The trace was started with a language whose address-space schema does not match the hardcoded 'ram' default. A custom memory mapper was not registered for the target language.","solutions":["Verify the Address.space matches the mapper's defaultSpace before calling map_back.","Register a custom DefaultMemoryMapper subclass in arch.memory_mappers for the target language that handles multi-space addresses.","Confirm the Ghidra language selected via compute_ghidra_lcsp uses a space compatible with 'ram'."],"exampleFix":"# before: address from wrong space passed blindly\noffset = mapper.map_back(proc, address)  # space != 'ram' raises\n\n# after: validate space before mapping\nif address.space != mapper.defaultSpace:\n    raise ValueError(\n        f\"Address space '{address.space}' != mapper space '{mapper.defaultSpace}'\")\noffset = mapper.map_back(proc, address)","handlingStrategy":"validation","validationCode":"mm = arch.compute_memory_mapper(language)\nif address.space != mm.defaultSpace:\n    raise ValueError(\n        f\"Address space '{address.space}' does not match mapper space '{mm.defaultSpace}'\")","typeGuard":"def address_in_default_space(addr: Address, mapper: 'DefaultMemoryMapper') -> bool:\n    return addr.space == mapper.defaultSpace","tryCatchPattern":"try:\n    offset = mapper.map_back(proc, address)\nexcept ValueError:\n    # address space mismatch; fall back or report\n    raise RuntimeError(f\"Cannot map address {address}: unsupported space\")","preventionTips":["Verify address.space matches the mapper's defaultSpace before calling map_back.","Register a custom memory mapper for languages with non-'ram' address spaces.","Ensure the Ghidra language selected matches the target's address-space model."],"tags":["x64dbg","debugger-agent","memory-mapper","valueerror","address-space"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}