NationalSecurityAgency/ghidra · error · TypeError
{object} is not {err_msg}
Error message
{object} is not {err_msg} What it means
Raised by find_availpid_by_pattern() (methods.py:75) when a TraceObject path does not match AVAILABLE_PATTERN. This guard validates that an object represents an Attachable (an available-to-attach process) before extracting the 'pid' capture group used for attach operations.
Source
Thrown at Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/methods.py:75
REGS_PATTERN = extre(FRAME_PATTERN, '\\.Registers')
MEMORY_PATTERN = extre(PROCESS_PATTERN, '\\.Memory')
MODULES_PATTERN = extre(PROCESS_PATTERN, '\\.Modules')
PROC_EVENTS_PATTERN = extre(PROC_DEBUG_PATTERN, '\\.Events')
PROC_EVENT_PATTERN = extre(PROC_EVENTS_PATTERN, '\\[(?P<eventnum>\\d*)\\]')
PROC_EVENT_CONT_PATTERN = extre(PROC_EVENT_PATTERN, '.Cont')
PROC_EVENT_EXEC_PATTERN = extre(PROC_EVENT_PATTERN, '.Exec')
PROC_EXCEPTIONS_PATTERN = extre(PROC_DEBUG_PATTERN, '\\.Exceptions')
PROC_EXCEPTION_PATTERN = extre(
PROC_EXCEPTIONS_PATTERN, '\\[(?P<excnum>\\d*)\\]')
PROC_EXCEPTION_CONT_PATTERN = extre(PROC_EXCEPTION_PATTERN, '.Cont')
PROC_EXCEPTION_EXEC_PATTERN = extre(PROC_EXCEPTION_PATTERN, '.Exec')
def find_availpid_by_pattern(pattern: re.Pattern, object: TraceObject,
err_msg: str) -> int:
mat = pattern.fullmatch(object.path)
if mat is None:
raise TypeError(f"{object} is not {err_msg}")
pid = int(mat['pid'])
return pid
def find_availpid_by_obj(object: TraceObject) -> int:
return find_availpid_by_pattern(AVAILABLE_PATTERN, object, "an Attachable")
def find_proc_by_num(id: int) -> int:
if id != util.selected_process():
util.select_process(id)
return util.selected_process()
def find_proc_by_pattern(object: TraceObject, pattern: re.Pattern,
err_msg: str) -> int:
mat = pattern.fullmatch(object.path)
if mat is None:View on GitHub (pinned to d5f144c24d)
Solutions
- Pass an object whose path matches the Available container pattern (e.g. 'Available[1234]').
- List available processes first and select the object from that container, not from Processes.
- Verify schema.xml / schema_exdi.xml version matches the agent build.
Example fix
// before
attach_proc(processes_obj) # path like 'Processes[0]'
// after
# obtain from the Available container:
avail_obj = trace.get_object('Available[1234]')
attach_proc(avail_obj) Defensive patterns
Strategy: type-guard
Validate before calling
from ghidradbg.methods import AVAILABLE_PATTERN
def is_attachable_obj(obj) -> bool:
return AVAILABLE_PATTERN.fullmatch(obj.path) is not None
if not is_attachable_obj(obj):
raise ValueError('expected an Attachable (Available[...]) object') Type guard
def is_attachable_obj(obj) -> bool:
from ghidradbg.methods import AVAILABLE_PATTERN
return bool(getattr(obj, 'path', None)) and AVAILABLE_PATTERN.fullmatch(obj.path) is not None Try / catch
try:
pid = find_availpid_by_obj(obj)
except TypeError as e:
if 'is not' in str(e):
raise ValueError(f'not an Attachable object: {obj}') from e
raise Prevention
- Source attach targets from the Available container, not Processes.
- Validate the path pattern before calling attach helpers.
- Keep schema versions in sync between agent and trace.
When it happens
Trigger: Calling an attach-related method with an object whose path is not under the Available container (e.g. a running Process, Thread, or Breakpoint object); path schema drift; invoking attach with a manually constructed TraceObject of the wrong type.
Common situations: Passing a Processes[...] object instead of an Available[...] object to an attach method; stale schema after a Ghidra version upgrade; misrouted method dispatch in custom scripts.
Related errors
- {object} is not {err_msg}
- {object} is not a Module
- Unsupported value: {}
- Invalid value for {}
- No such address space: %s
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/62913a9318040f48.
Report an issue: GitHub.