NationalSecurityAgency/ghidra · error · RuntimeError
No memory mapper
Error message
No memory mapper
What it means
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.
Source
Thrown at Ghidra/Debug/Debugger-agent-x64dbg/src/main/py/src/ghidraxdbg/commands.py:102
class ErrorWithCode(Exception):
def __init__(self, code: int) -> None:
self.code = code
def __str__(self) -> str:
return repr(self.code)
class Extra(object):
def __init__(self) -> None:
self.memory_mapper: Optional[arch.DefaultMemoryMapper] = None
self.register_mapper: Optional[arch.DefaultRegisterMapper] = None
def require_mm(self) -> arch.DefaultMemoryMapper:
if self.memory_mapper is None:
raise RuntimeError("No memory mapper")
return self.memory_mapper
def require_rm(self) -> arch.DefaultRegisterMapper:
if self.register_mapper is None:
raise RuntimeError("No register mapper")
return self.register_mapper
class State(object):
def __init__(self) -> None:
self.reset_client()
def require_client(self) -> Client:
if self.client is None:
raise RuntimeError("Not connected")
return self.client
View on GitHub (pinned to d5f144c24d)
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.
Example fix
# before: memory op before trace start STATE.require_trace().extra.require_mm() # mapper is None # after: start trace first start_trace(compute_name()) mm = STATE.trace.extra.require_mm() # mapper now set
Defensive patterns
Strategy: validation
Validate before calling
extra = STATE.trace.extra if STATE.trace else None
if extra is None or extra.memory_mapper is None:
raise RuntimeError("Memory mapper not initialized; run 'ghidra trace start' first") Type guard
def has_memory_mapper(extra: 'Extra') -> bool:
return extra is not None and extra.memory_mapper is not None Try / catch
try:
mm = STATE.trace.extra.require_mm()
except RuntimeError:
# trace not started or mapper not set; start trace to initialize
start_trace(compute_name())
mm = STATE.trace.extra.require_mm() Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/cce19e09a03638e8.
Report an issue: GitHub.