NationalSecurityAgency/ghidra · error · TypeError
{object} is not {err_msg}
Error message
{object} is not {err_msg} What it means
Raised as a TypeError by find_availpid_by_pattern (methods.py:67-69) when the TraceObject's path does not fullmatch AVAILABLE_PATTERN (Sessions[snum].Available[pid]). err_msg is 'an Attachable'. The agent routes trace-RMI method calls by matching object paths against compiled regexes; a mismatch means the caller supplied an object of the wrong kind.
Source
Thrown at Ghidra/Debug/Debugger-agent-x64dbg/src/main/py/src/ghidraxdbg/methods.py:69
PROC_SBREAKBPT_PATTERN = extre(PROC_SBREAKS_PATTERN, '\\[(?P<breaknum>\\d*)\\]')
PROC_HBREAKBPT_PATTERN = extre(PROC_HBREAKS_PATTERN, '\\[(?P<breaknum>\\d*)\\]')
PROC_MBREAKBPT_PATTERN = extre(PROC_MBREAKS_PATTERN, '\\[(?P<breaknum>\\d*)\\]')
ENV_PATTERN = extre(PROCESS_PATTERN, '\\.Environment')
THREADS_PATTERN = extre(PROCESS_PATTERN, '\\.Threads')
THREAD_PATTERN = extre(THREADS_PATTERN, '\\[(?P<tnum>\\d*)\\]')
STACK_PATTERN = extre(THREAD_PATTERN, '\\.Stack.Frames')
#FRAME_PATTERN = extre(STACK_PATTERN, '\\[(?P<level>\\d*)\\]')
REGS_PATTERN0 = extre(THREAD_PATTERN, '\\.Registers')
#REGS_PATTERN = extre(FRAME_PATTERN, '\\.Registers')
MEMORY_PATTERN = extre(PROCESS_PATTERN, '\\.Memory')
MODULES_PATTERN = extre(PROCESS_PATTERN, '\\.Modules')
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:
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:
raise TypeError(f"{object} is not {err_msg}")
procnum = int(mat['procnum'])View on GitHub (pinned to d5f144c24d)
Solutions
- Pass a TraceObject whose path matches the Available pattern (Sessions[s].Available[pid]).
- Verify object.path matches AVAILABLE_PATTERN before invoking the attach-related method.
- Ensure the trace schema and object tree are populated so the Available nodes exist.
Example fix
// before find_availpid_by_obj(process_object) # path is Processes[0] // after find_availpid_by_obj(available_object) # path is Sessions[0].Available[1234]
Defensive patterns
Strategy: type-guard
Validate before calling
def require_attachable(obj):
if AVAILABLE_PATTERN.fullmatch(obj.path) is None:
raise ValueError(f'{obj.path} is not an Attachable path')
return find_availpid_by_obj(obj) Type guard
def is_attachable(obj) -> bool:
return AVAILABLE_PATTERN.fullmatch(getattr(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'Activate an Available node, not {obj.path}') from e
raise Prevention
- Confirm the active object's path matches the Available pattern before attach calls.
- Build object paths from the schema constants rather than hand-crafted strings.
- Handle TypeError from the finders and surface a clear 'wrong object type' message.
When it happens
Trigger: A trace-RMI method that expects an Attachable object is invoked with a TraceObject whose path is a Process, Thread, Memory, or any other node. pattern.fullmatch(object.path) returns None.
Common situations: The UI/method caller activates the wrong object type (e.g. a Processes node instead of an Available node) and a method bound to attach is fired; schema/path drift where the object tree shape changed but the method binding did not.
Related errors
- min out of range of int64
- max out of range of int64
- min cannot exceed max
- Address {address} is not in process {proc}
- Invalid byte_order: {}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/8174566a0ee229e1.
Report an issue: GitHub.