{"record":{"id":"3345ba96f4550811","repo":"NationalSecurityAgency/ghidra","slug":"object-is-not-err-msg-3345ba","errorCode":null,"errorMessage":"{object} is not {err_msg}","messagePattern":"(.+?) is not (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/methods.py","lineNumber":57,"sourceCode":"PROC_BREAKS_PATTERN = extre(PROCESS_PATTERN, '\\.Breakpoints')\nPROC_BREAK_PATTERN = extre(PROC_BREAKS_PATTERN, '\\[(?P<breaknum>\\\\d*)\\]')\nPROC_BREAKLOC_PATTERN = extre(PROC_BREAK_PATTERN, '\\[(?P<locnum>\\\\d*)\\]')\nPROC_WATCHES_PATTERN = extre(PROCESS_PATTERN, '\\.Watchpoints')\nPROC_WATCH_PATTERN = extre(PROC_WATCHES_PATTERN, '\\[(?P<watchnum>\\\\d*)\\]')\nENV_PATTERN = extre(PROCESS_PATTERN, '\\.Environment')\nTHREADS_PATTERN = extre(PROCESS_PATTERN, '\\.Threads')\nTHREAD_PATTERN = extre(THREADS_PATTERN, '\\[(?P<tnum>\\\\d*)\\]')\nSTACK_PATTERN = extre(THREAD_PATTERN, '\\.Stack')\nFRAME_PATTERN = extre(STACK_PATTERN, '\\[(?P<level>\\\\d*)\\]')\nREGS_PATTERN = extre(FRAME_PATTERN, '.Registers')\nMEMORY_PATTERN = extre(PROCESS_PATTERN, '\\.Memory')\nMODULES_PATTERN = extre(PROCESS_PATTERN, '\\.Modules')\n\n\ndef find_availpid_by_pattern(pattern: re.Pattern, object: TraceObject, err_msg: str) -> int:\n    mat = pattern.fullmatch(object.path)\n    if mat is None:\n        raise TypeError(f\"{object} is not {err_msg}\")\n    pid = int(mat['pid'])\n    return pid\n\n\ndef find_availpid_by_obj(object: TraceObject) -> int:\n    return find_availpid_by_pattern(AVAILABLE_PATTERN, object, \"an Available\")\n\n\ndef find_proc_by_num(procnum: int) -> lldb.SBProcess:\n    return util.get_process()\n\n\ndef find_proc_by_pattern(object: TraceObject, pattern: re.Pattern,\n                         err_msg: str) -> lldb.SBProcess:\n    mat = pattern.fullmatch(object.path)\n    if mat is None:\n        raise TypeError(f\"{object} is not {err_msg}\")\n    procnum = int(mat['procnum'])","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/methods.py#L39-L75","documentation":"Raised by find_availpid_by_pattern (methods.py:57) as a TypeError when a TraceObject's path does not match the AVAILABLE_PATTERN (`Available[<pid>]`). The function extracts a pid from the path via regex fullmatch; a non-matching path means the object is not an 'Available' node, so the agent refuses to derive a pid from it.","triggerScenarios":"Ghidra's TraceRmi invokes an Available-scoped method (e.g. attach by available process) on an object whose path is a Process, Threads, Memory, or malformed node instead of `Available[<pid>]`. Caused by schema/path mismatch between Ghidra and the agent, stale traces, or a method routed to the wrong object type.","commonSituations":"Version skew between the agent and Ghidra's object schema; using a trace opened against a different target; or custom method invocations that pass an arbitrary object path. The error is an internal API contract violation more than a user typo.","solutions":["Verify the object path is exactly `Available[<pid>]` before invoking the method.","Restart/refresh the trace so the schema and available list are consistent with the current target.","Ensure the agent and Ghidra versions match to avoid pattern/schema drift."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"import re\nAVAILABLE_PATTERN = re.compile(r'Available\\[(?P<pid>\\d*)\\]')\ndef is_available_obj(path: str) -> bool:\n    return AVAILABLE_PATTERN.fullmatch(path) is not None","typeGuard":"def is_available_obj(path: str) -> bool:\n    import re\n    return re.fullmatch(r'Available\\[\\d*\\]', path) is not None","tryCatchPattern":"try:\n    pid = find_availpid_by_obj(obj)\nexcept TypeError:\n    # obj is not an Available node; re-route to the correct method/handler\n    ...","preventionTips":["Ensure available nodes are created (put-available) before invoking Available-scoped methods.","Keep agent and Ghidra schema versions aligned.","Validate object paths against AVAILABLE_PATTERN before deriving a pid."],"tags":["lldb","ghidra","typeerror","trace-objects","schema-mismatch","debugger-agent"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}