{"record":{"id":"1c1c48a82cb0173e","repo":"NationalSecurityAgency/ghidra","slug":"cannot-locate-schema-xml-1c1c48","errorCode":null,"errorMessage":"cannot locate schema.xml","messagePattern":"cannot locate schema\\.xml","errorType":"exception","errorClass":"AssertionError","httpStatus":null,"severity":"critical","filePath":"Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/commands.py","lineNumber":298,"sourceCode":"\ndef compute_name() -> str:\n    progname = gdb.selected_inferior().progspace.filename\n    if progname is None:\n        return 'gdb/noname'\n    else:\n        return 'gdb/' + re.split(r'(/|\\\\)', progname)[-1]\n\n\ndef start_trace(name: str) -> None:\n    language, compiler = arch.compute_ghidra_lcsp()\n    STATE.trace = STATE.require_client().create_trace(\n        name, language, compiler, extra=Extra())\n    STATE.trace.extra.memory_mapper = arch.compute_memory_mapper(language)\n    STATE.trace.extra.register_mapper = arch.compute_register_mapper(language)\n\n    frame = inspect.currentframe()\n    if frame is None:\n        raise AssertionError(\"cannot locate schema.xml\")\n\n    parent = os.path.dirname(inspect.getfile(frame))\n    schema_fn = os.path.join(parent, 'schema.xml')\n    with open(schema_fn, 'r') as schema_file:\n        schema_xml = schema_file.read()\n\n    with STATE.trace.open_tx(\"Create Root Object\"):\n        root = STATE.trace.create_root_object(schema_xml, 'GdbSession')\n        root.set_value('_display', 'GNU gdb ' + util.GDB_VERSION.full)\n        STATE.trace.create_object(AVAILABLES_PATH).insert()\n        STATE.trace.create_object(BREAKPOINTS_PATH).insert()\n        STATE.trace.create_object(INFERIORS_PATH).insert()\n    gdb.set_convenience_variable('_ghidra_tracing', True)\n\n\n@cmd('ghidra trace start', '-ghidra-trace-start', gdb.COMMAND_DATA, False)\ndef ghidra_trace_start(name: Optional[str] = None, *, is_mi: bool,\n                       **kwargs) -> None:","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/commands.py#L280-L316","documentation":"Thrown as an AssertionError by start_trace in the gdb agent when inspect.currentframe() returns None, preventing the code from deriving the path to schema.xml. The frame is used to find the package directory containing schema.xml via inspect.getfile(frame). Under standard CPython this is essentially unreachable.","triggerScenarios":"Running the gdb agent Python code under a non-standard interpreter or restricted environment where inspect.currentframe() returns None. This is the gdb-side equivalent of error 163 and is equally rare.","commonSituations":"Effectively never occurs under standard CPython or GDB's embedded Python. Could theoretically arise in sandboxed or embedded Python environments where frame introspection is disabled.","solutions":["Run the gdb agent under standard CPython (GDB's built-in Python is CPython).","Ensure frame inspection is not disabled in the Python runtime.","Verify schema.xml exists in the same directory as commands.py in the ghidragdb package."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"import inspect, os\n\ndef verify_schema_available() -> bool:\n    frame = inspect.currentframe()\n    if frame is None:\n        return False\n    parent = os.path.dirname(inspect.getfile(frame))\n    return os.path.isfile(os.path.join(parent, 'schema.xml'))","typeGuard":null,"tryCatchPattern":"try:\n    start_trace(name)\nexcept AssertionError as e:\n    if 'schema.xml' in str(e):\n        print('Frame inspection unavailable. Use standard CPython via GDB.')\n    raise","preventionTips":["Run the gdb agent under GDB's standard embedded CPython.","Do not disable frame inspection in the Python runtime.","Verify schema.xml ships alongside commands.py in the ghidragdb package."],"tags":["gdb","assertion","runtime-environment","schema"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}