{"record":{"id":"2cd2fbc8179f10b7","repo":"NationalSecurityAgency/ghidra","slug":"no-register-mapper","errorCode":null,"errorMessage":"No register mapper","messagePattern":"No register mapper","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/commands.py","lineNumber":110,"sourceCode":"        self.code = code\n\n    def __str__(self) -> str:\n        return repr(self.code)\n\n\nclass Extra(object):\n    def __init__(self) -> None:\n        self.memory_mapper: Optional[arch.DefaultMemoryMapper] = None\n        self.register_mapper: Optional[arch.DefaultRegisterMapper] = None\n\n    def require_mm(self) -> arch.DefaultMemoryMapper:\n        if self.memory_mapper is None:\n            raise RuntimeError(\"No memory mapper\")\n        return self.memory_mapper\n\n    def require_rm(self) -> arch.DefaultRegisterMapper:\n        if self.register_mapper is None:\n            raise RuntimeError(\"No register mapper\")\n        return self.register_mapper\n\n\nclass State(object):\n\n    def __init__(self) -> None:\n        self.reset_client()\n\n    def require_client(self) -> Client:\n        if self.client is None:\n            raise RuntimeError(\"Not connected\")\n        return self.client\n\n    def require_no_client(self) -> None:\n        if self.client != None:\n            raise RuntimeError(\"Already connected\")\n\n    def reset_client(self) -> None:","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/commands.py#L92-L128","documentation":"Thrown by Extra.require_rm() when the register_mapper attribute is None — no architecture-specific register mapper has been configured. Like error 115 but for registers: any command requiring register value translation (read/write registers) will fail until the register mapper is initialized with the correct byte order and register name mappings.","triggerScenarios":"STATE.require_rm() (via Extra.require_rm()) is called by register-related commands (e.g., ghidra_trace_putreg, ghidra_trace_getreg), but Extra.register_mapper is still None. Occurs when register commands are issued before architecture detection sets up the mapper.","commonSituations":"The user issues a register read/write command before the architecture is configured. Architecture detection failed or hasn't run. The debugging session was reset (reset_client/reset_trace) without re-initializing the register mapper.","solutions":["Connect to the target and run architecture detection before issuing register commands.","Verify that the register mapper initialization code runs after connection establishment.","Check that DefaultRegisterMapper is constructed with a valid byte_order ('big' or 'little') for the target.","Re-run the setup sequence if the session was reset."],"exampleFix":"# Before: issuing register command without mapper\n# ghidra_trace_putreg(...)\n#\n# After: ensure register mapper is initialized\n# if STATE.extra.register_mapper is None:\n#     arch.compute_ghidra_lcsp()  # triggers arch detection and mapper setup\n# ghidra_trace_putreg(...)","handlingStrategy":"validation","validationCode":"# Before calling require_rm, check and initialize if needed:\nif STATE.extra.register_mapper is None:\n    # run architecture detection to set up register mapper\n    lang = arch.compute_ghidra_language()\n    # mapper is set during arch detection\nSTATE.extra.require_rm()","typeGuard":"def has_register_mapper(extra) -> bool:\n    return extra.register_mapper is not None","tryCatchPattern":"try:\n    rm = STATE.extra.require_rm()\nexcept RuntimeError as e:\n    if str(e) == 'No register mapper':\n        # run setup/arch detection, then retry\n        pass\n    else:\n        raise","preventionTips":["Ensure architecture detection runs after connection to initialize the register mapper.","Verify byte_order is valid before constructing the register mapper.","Re-initialize mappers after session resets.","Test the full connection-to-command lifecycle on all supported architectures."],"tags":["debugger-agent","register-mapper","initialization","python","state-management"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}