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_proc_by_pattern in the drgn agent when a TraceObject's path does not match the PROCESS_PATTERN regex. This function extracts a process number from the object's canonical path string; a non-matching path means the object is not a valid process reference.
Source
Thrown at Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/methods.py:116
class Thread(TraceObject):
pass
class ThreadContainer(TraceObject):
pass
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:
raise TypeError(f"{object} is not {err_msg}")
procnum = int(mat['procnum'])
return find_proc_by_num(procnum)
def find_proc_by_obj(object: TraceObject) -> int:
return find_proc_by_pattern(object, PROCESS_PATTERN, "an Process")
def find_proc_by_env_obj(object: TraceObject) -> int:
return find_proc_by_pattern(object, ENV_PATTERN, "an Environment")
def find_proc_by_threads_obj(object: TraceObject) -> int:
return find_proc_by_pattern(object, THREADS_PATTERN, "a ThreadContainer")
def find_proc_by_mem_obj(object: TraceObject) -> int:
return find_proc_by_pattern(object, MEMORY_PATTERN, "a Memory")View on GitHub (pinned to d5f144c24d)
Solutions
- Pass a TraceObject whose path matches the process pattern, e.g. 'Processes[1]'.
- Verify the object type before calling — use find_proc_by_obj which delegates to this function.
- Check that the path string has the exact format 'Processes[<procnum>]'.
Defensive patterns
Strategy: validation
Validate before calling
import re
# PROCESS_PATTERN must match the one defined in methods.py
PROCESS_PATTERN_TEST = re.compile(r'Processes\[(?P<procnum>\d+)\]')
def is_process_path(path: str) -> bool:
return PROCESS_PATTERN_TEST.fullmatch(path) is not None Type guard
def is_process_object(obj: TraceObject) -> bool:
return PROCESS_PATTERN_TEST.fullmatch(obj.path) is not None Try / catch
try:
find_proc_by_obj(obj)
except TypeError as e:
print(f'Object path does not match process pattern: {obj.path}')
raise Prevention
- Verify the TraceObject path matches 'Processes[<n>]' before calling process methods.
- Use the correct find_*_by_obj function for each object type.
- Check obj.path format in the Ghidra UI before passing to the API.
When it happens
Trigger: Passing a TraceObject whose path does not conform to the process path schema (e.g. a thread path like 'Processes[1].Threads[2]' when a process path like 'Processes[1]' is expected). The regex fullmatch fails and TypeError is raised.
Common situations: Calling a method that expects a process object with a thread, frame, or module object instead; path string was manually constructed incorrectly; the Ghidra UI passed the wrong object type to a drgn method.
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/6936c5f841348fce.
Report an issue: GitHub.