NationalSecurityAgency/ghidra · error · RuntimeError
Cannot convert '{address}' to address
Error message
Cannot convert '{address}' to address What it means
Raised by eval_address() (commands.py:542-549) when util.parse_and_eval(address) either throws or returns a non-int. eval_address is the central resolver that turns a user-supplied string or int (a symbol, expression, or hex literal) into a numeric address via the dbgeng expression evaluator. Any failure is normalized to this RuntimeError, masking the underlying cause.
Source
Thrown at Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/commands.py:549
if isinstance(count, Future):
count.add_done_callback(lambda c: print(f"Wrote {c} bytes"))
else:
print(f"Wrote {count} bytes")
if isinstance(count, Future):
return {'count': -1}
else:
return {'count': count}
return {'count': 0}
def eval_address(address: Union[str, int]) -> int:
try:
result = util.parse_and_eval(address)
if isinstance(result, int):
return result
raise ValueError(f"Value '{address}' does not evaluate to an int")
except Exception:
raise RuntimeError(f"Cannot convert '{address}' to address")
def eval_range(address: Union[str, int],
length: Union[str, int]) -> Tuple[int, int]:
start = eval_address(address)
try:
l = util.parse_and_eval(length)
except Exception as e:
raise RuntimeError(f"Cannot convert '{length}' to length")
if not isinstance(l, int):
raise ValueError(f"Value '{address}' does not evaluate to an int")
end = start + l
return start, end
def putmem(address: Union[str, int], length: Union[str, int],
pages: bool = True, display_result: bool = True) -> Dict[str, int]:
start, end = eval_range(address, length)View on GitHub (pinned to d5f144c24d)
Solutions
- Confirm the symbol exists at the current break with the debugger's native evaluator (e.g. '? mysymbol' or 'x mymodule!sym') before issuing the command.
- Verify a process is loaded and the debugger is in break state so the evaluator has context.
- Pass a plain hex int (0x...) to bypass symbol resolution when you know the address.
- Check the evaluator syntax matches the current mode (MASM vs C++).
Example fix
// before
ghidra_trace_putmem('mymissingmod!main', 0x100)
// after
# resolve/verify first:
# WinDbg> x mymodule!main
ghidra_trace_putmem('mymodule!main', 0x100)
# or pass a known address directly:
ghidra_trace_putmem(0x140001000, 0x100) Defensive patterns
Strategy: try-catch
Validate before calling
def resolve_address_safe(expr):
try:
v = util.parse_and_eval(expr)
except Exception:
return None
return v if isinstance(v, int) else None
addr = resolve_address_safe(address)
if addr is None:
raise ValueError(f'cannot resolve address {address!r}; check symbol/mode') Type guard
def address_resolves(expr) -> bool:
try:
return isinstance(util.parse_and_eval(expr), int)
except Exception:
return False Try / catch
try:
ghidra_trace_putmem(address, length)
except RuntimeError as e:
if 'Cannot convert' in str(e) and 'to address' in str(e):
# fall back to a literal int address, or verify symbol first
raise ValueError(f'unresolvable address: {address!r}') from e
raise Prevention
- Verify symbols with 'x module!sym' before referencing them.
- Pass literal hex ints when you know the address.
- Ensure the target is in break state with modules loaded.
When it happens
Trigger: Calling ghidra_trace_putmem/ghidra_trace_delmem/ghidra_trace_putmem_state with a symbol that does not exist in the current module; passing an expression referencing an unloaded module; passing a malformed hex like '0xZZ'; passing a value when no process is loaded so the evaluator has no symbol context.
Common situations: Symbol not yet resolved because the target DLL/module is not loaded at the time of the call; typo in a symbol name; wrong radix ('#' MASM suffix in a C++ evaluator, or vice versa); calling before the process is in a break state.
Related errors
- Cannot convert '{length}' to length
- Value '{address}' does not evaluate to an int
- Failed to read memory
- Cannot read memory at {start:x}
- Cannot convert '{address}' to address: {e}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/bea129dbd9715889.
Report an issue: GitHub.