NationalSecurityAgency/ghidra · error · TypeError
{object} is not {err_msg}
Error message
{object} is not {err_msg} What it means
Thrown as a TypeError by find_availpid_by_pattern in the gdb agent when a TraceObject's path does not match the AVAILABLE_PATTERN regex. This function extracts a PID from the object's path in the Available processes tree; a non-matching path means the object does not represent an available process.
Source
Thrown at Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/methods.py:89
BREAK_LOC_PATTERN = extre(BREAKPOINT_PATTERN, '\\[(?P<locnum>\\d*)\\]')
INFERIOR_PATTERN = re.compile('Inferiors\\[(?P<infnum>\\d*)\\]')
INF_BREAKS_PATTERN = extre(INFERIOR_PATTERN, '\\.Breakpoints')
ENV_PATTERN = extre(INFERIOR_PATTERN, '\\.Environment')
THREADS_PATTERN = extre(INFERIOR_PATTERN, '\\.Threads')
THREAD_PATTERN = extre(THREADS_PATTERN, '\\[(?P<tnum>\\d*)\\]')
STACK_PATTERN = extre(THREAD_PATTERN, '\\.Stack')
FRAME_PATTERN = extre(STACK_PATTERN, '\\[(?P<level>\\d*)\\]')
REGS_PATTERN = extre(FRAME_PATTERN, '\\.Registers')
MEMORY_PATTERN = extre(INFERIOR_PATTERN, '\\.Memory')
MODULES_PATTERN = extre(INFERIOR_PATTERN, '\\.Modules')
MODULE_PATTERN = extre(MODULES_PATTERN, '\\[(?P<modname>.*)\\]')
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 Available")
def find_inf_by_num(infnum: int) -> gdb.Inferior:
for inf in gdb.inferiors():
if inf.num == infnum:
return inf
raise KeyError(f"Inferiors[{infnum}] does not exist")
def find_inf_by_pattern(object: TraceObject, pattern: re.Pattern,
err_msg: str) -> gdb.Inferior:
mat = pattern.fullmatch(object.path)View on GitHub (pinned to d5f144c24d)
Solutions
- Pass a TraceObject whose path matches the Available pattern, e.g. 'Available[1234]'.
- Use find_availpid_by_obj which applies AVAILABLE_PATTERN automatically.
- Ensure the path starts with 'Available[' followed by a numeric PID.
Defensive patterns
Strategy: validation
Validate before calling
import re
AVAILABLE_PATTERN_TEST = re.compile(r'Available\[(?P<pid>\d+)\]')
def is_available_path(path: str) -> bool:
return AVAILABLE_PATTERN_TEST.fullmatch(path) is not None Type guard
def is_available_object(obj: TraceObject) -> bool:
return AVAILABLE_PATTERN_TEST.fullmatch(obj.path) is not None Try / catch
try:
pid = find_availpid_by_obj(obj)
except TypeError as e:
print(f'Object path does not match Available pattern: {obj.path}')
raise Prevention
- Verify the path matches 'Available[<pid>]' before calling available-process methods.
- Distinguish Available objects from Inferior objects by path prefix.
- Use find_availpid_by_obj which applies the correct pattern automatically.
When it happens
Trigger: Passing a TraceObject whose path is an Inferior path ('Inferiors[1]') or a thread path when an Available process path ('Available[1234]') is expected. The regex fullmatch fails and TypeError is raised.
Common situations: Using an Inferior object where an Available object is required; the path was constructed from the wrong tree node; Ghidra UI passed the wrong object type.
Related errors
- {object} is not {err_msg}
- only DBTrace objects are supported
- only DBTrace files are supported
- Value '{address}' does not evaluate to an int
- {node} is not {err_msg}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/f1c49f306faf91d8.
Report an issue: GitHub.