{"record":{"id":"1b10f7aa31499b8c","repo":"NationalSecurityAgency/ghidra","slug":"given-symbol-is-not-part-of-this-trace","errorCode":null,"errorMessage":"Given symbol is not part of this trace","messagePattern":"Given symbol is not part of this trace","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewSymbolTable.java","lineNumber":498,"sourceCode":"\t\t}\n\t\treturn symbolManager.getGlobalNamespace();\n\t}\n\n\t@Override\n\tpublic Iterator<GhidraClass> getClassNamespaces() {\n\t\treturn DBTraceUtils.covariantIterator(symbolManager.classes().getAll(true).iterator());\n\t}\n\n\t@Override\n\tpublic GhidraClass createClass(Namespace parent, String name, SourceType source)\n\t\t\tthrows DuplicateNameException, InvalidInputException {\n\t\treturn symbolManager.classes().add(name, assertTraceNamespace(parent), source);\n\t}\n\n\t@Override\n\tpublic SymbolIterator getChildren(Symbol parentSymbol) {\n\t\tif (!(parentSymbol instanceof TraceSymbol)) {\n\t\t\tthrow new IllegalArgumentException(\"Given symbol is not part of this trace\");\n\t\t}\n\t\tif (!(parentSymbol instanceof TraceNamespaceSymbol)) {\n\t\t\treturn new SymbolIteratorAdapter(Collections.emptyIterator());\n\t\t}\n\t\tTraceNamespaceSymbol parent = (TraceNamespaceSymbol) parentSymbol;\n\t\treturn new SymbolIteratorAdapter(symbolManager.allSymbols().getChildren(parent).iterator());\n\t}\n\n\t@Override\n\tpublic Library createExternalLibrary(String name, SourceType source)\n\t\t\tthrows DuplicateNameException, InvalidInputException {\n\t\tthrow new UnsupportedOperationException();\n\t}\n\n\t@Override\n\tpublic Namespace createNameSpace(Namespace parent, String name, SourceType source)\n\t\t\tthrows DuplicateNameException, InvalidInputException {\n\t\treturn symbolManager.namespaces().add(name, assertTraceNamespace(parent), source);","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewSymbolTable.java#L480-L516","documentation":"Thrown as IllegalArgumentException by getChildren when the parentSymbol is not an instance of TraceSymbol. The trace symbol table can only enumerate children of trace-owned symbols; a Symbol from a regular Program or unrelated implementation has no children in the trace hierarchy.","triggerScenarios":"Calling getChildren(parentSymbol) with a Symbol object obtained from a static Program or a non-trace source.","commonSituations":"Generic tree-walking code that recurses getChildren on any Symbol, including those from a static Program, when operating on a trace view. Mixing symbols from Program and trace views in the same traversal.","solutions":["Guard the call: verify parentSymbol instanceof TraceSymbol before calling getChildren.","Source parent symbols from the trace view's own symbol table.","Skip or return an empty iterator for non-trace symbols instead of passing them in."],"exampleFix":"// before\nSymbolIterator it = symbolTable.getChildren(parentSymbol);\n\n// after\nif (!(parentSymbol instanceof TraceSymbol)) {\n    return SymbolIterator.EMPTY_ITERATOR;\n}\nSymbolIterator it = symbolTable.getChildren(parentSymbol);","handlingStrategy":"type-guard","validationCode":"// Only call getChildren on trace-owned symbols\nif (parentSymbol instanceof TraceSymbol) {\n    SymbolIterator it = symbolTable.getChildren(parentSymbol);\n} else {\n    // return empty iterator for non-trace symbols\n}","typeGuard":"static boolean isTraceSymbol(Symbol s) {\n    return s instanceof TraceSymbol;\n}","tryCatchPattern":null,"preventionTips":["Type-check parentSymbol instanceof TraceSymbol before getChildren.","Source parent symbols from the trace view's own symbol table.","Return an empty iterator for non-trace symbols rather than passing them in."],"tags":["trace-modeling","symbol","type-check","validation","ghidra"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}