{"record":{"id":"cce19e09a03638e8","repo":"NationalSecurityAgency/ghidra","slug":"no-memory-mapper-cce19e","errorCode":null,"errorMessage":"No memory mapper","messagePattern":"No memory mapper","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-x64dbg/src/main/py/src/ghidraxdbg/commands.py","lineNumber":102,"sourceCode":"\n\nclass ErrorWithCode(Exception):\n\n    def __init__(self, code: int) -> None:\n        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","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-x64dbg/src/main/py/src/ghidraxdbg/commands.py#L84-L120","documentation":"Raised by Extra.require_mm when the trace's memory_mapper has not been set. The memory mapper translates between Ghidra Address objects and x64dbg offsets; it is initialized during start_trace via compute_memory_mapper. Any memory operation that calls require_mm before start_trace completes will hit this guard.","triggerScenarios":"A trace method calls STATE.trace.extra.require_mm() (directly or via a memory operation) before start_trace has set memory_mapper. This happens if commands are issued before 'ghidra trace start' completes or if the trace object's extra was not properly initialized.","commonSituations":"The user issued memory read/write commands before starting a trace. start_trace failed partway through (e.g. schema.xml not found) leaving mappers unset. The trace was created manually without going through start_trace.","solutions":["Ensure 'ghidra trace start' (or start_trace) completes successfully before issuing memory commands.","Verify start_trace ran without errors (check for schema.xml load failures).","Call STATE.trace.extra.memory_mapper = arch.compute_memory_mapper(language) if mappers are missing."],"exampleFix":"# before: memory op before trace start\nSTATE.require_trace().extra.require_mm()  # mapper is None\n\n# after: start trace first\nstart_trace(compute_name())\nmm = STATE.trace.extra.require_mm()  # mapper now set","handlingStrategy":"validation","validationCode":"extra = STATE.trace.extra if STATE.trace else None\nif extra is None or extra.memory_mapper is None:\n    raise RuntimeError(\"Memory mapper not initialized; run 'ghidra trace start' first\")","typeGuard":"def has_memory_mapper(extra: 'Extra') -> bool:\n    return extra is not None and extra.memory_mapper is not None","tryCatchPattern":"try:\n    mm = STATE.trace.extra.require_mm()\nexcept RuntimeError:\n    # trace not started or mapper not set; start trace to initialize\n    start_trace(compute_name())\n    mm = STATE.trace.extra.require_mm()","preventionTips":["Always run 'ghidra trace start' before issuing memory commands.","Verify start_trace completed without errors (schema.xml, language detection).","Check STATE.trace.extra.memory_mapper is not None before memory operations."],"tags":["x64dbg","debugger-agent","state-machine","runtimeerror","memory-mapper","initialization"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}