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:462-463) as the user-facing RuntimeError wrapping every failure inside the try block: parse_and_eval throwing, returning a non-int (the inner ValueError from [286]), or any other Exception. It is the catch-all 'address could not be converted' message that callers actually see.
Source
Thrown at Ghidra/Debug/Debugger-agent-x64dbg/src/main/py/src/ghidraxdbg/commands.py:463
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
- Verify the address expression resolves before using it: test util.parse_and_eval(address) interactively.
- Pass a literal hex/integer address when symbols are unavailable.
- Ensure the target process/module is loaded so symbol resolution succeeds.
- Catch RuntimeError around eval_address and report the bad input to the user.
Example fix
// before
putmem('UndefinedSymbol', 0x10) # -> Cannot convert 'UndefinedSymbol' to address
// after
putmem('main', 0x10) # resolved symbol, or
putmem(0x00401000, 0x10) # literal address Defensive patterns
Strategy: try-catch
Validate before calling
def try_eval_address(address):
try:
r = util.parse_and_eval(address)
except Exception:
return int(address, 16) if isinstance(address, str) else int(address)
return r if isinstance(r, int) else int(address, 0) Type guard
def is_evaluatable_address(address) -> bool:
try:
return isinstance(util.parse_and_eval(address), int)
except Exception:
return isinstance(address, int) or (
isinstance(address, str) and address.strip().startswith(('0x', '0X'))
) Try / catch
try:
putmem(address, length)
except RuntimeError as e:
if 'Cannot convert' in str(e) and 'to address' in str(e):
log.warning('bad address %r; skipping', address)
else:
raise Prevention
- Verify symbol resolution interactively before scripting putmem/delmem.
- Fall back to literal hex addresses when symbols are unavailable.
- Ensure the target process/module is loaded so evaluation has context.
When it happens
Trigger: Calling eval_address (directly or via putmem/delmem/putmem_state/ghidra_trace_putmem etc.) with an address expression that parse_and_eval cannot resolve to an integer: an undefined symbol, malformed expression, or a value of the wrong type.
Common situations: Typos in symbol names; querying an address before the module/symbols are loaded; passing an expression syntax the evaluator does not understand; a debugger not in a state where evaluation is possible.
Related errors
- Value '{address}' does not evaluate to an int
- Cannot convert '{length}' to length
- Transaction already started
- 'ghidra_trace_connect': missing required argument 'address'
- address must be in the form 'host:port'
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/3830ec265dc34426.
Report an issue: GitHub.