{"record":{"id":"8c32e0c8a28c43eb","repo":"NationalSecurityAgency/ghidra","slug":"the-given-symbol-is-not-part-of-this-trace","errorCode":null,"errorMessage":"The given symbol is not part of this trace","messagePattern":"The 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":104,"sourceCode":"\tpublic Symbol createLabel(Address addr, String name, SourceType source)\n\t\t\tthrows InvalidInputException {\n\t\treturn symbolManager.labels().create(program.snap, addr, name, global, source);\n\t}\n\n\t@Override\n\tpublic Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)\n\t\t\tthrows InvalidInputException {\n\t\treturn symbolManager.labels()\n\t\t\t\t.create(program.snap, addr, name, assertTraceNamespace(namespace), source);\n\t}\n\n\t@Override\n\tpublic boolean removeSymbolSpecial(Symbol sym) {\n\t\t// TODO: I'm not sure I understand the point of this method...\n\t\ttry (LockHold hold = program.trace.lockWrite()) {\n\t\t\tAbstractDBTraceSymbol dbSym = symbolManager.getSymbolByID(sym.getID());\n\t\t\tif (sym != dbSym) {\n\t\t\t\tthrow new IllegalArgumentException(\"The given symbol is not part of this trace\");\n\t\t\t}\n\t\t\tif (dbSym.getSymbolType() != SymbolType.FUNCTION) {\n\t\t\t\treturn dbSym.delete();\n\t\t\t}\n\t\t\tAddress address = dbSym.getAddress();\n\t\t\tCollection<? extends TraceLabelSymbol> at =\n\t\t\t\tsymbolManager.labels().getAt(program.snap, address, false);\n\t\t\tString name;\n\t\t\tTraceNamespaceSymbol parent;\n\t\t\tSourceType source;\n\t\t\tif (at.isEmpty()) {\n\t\t\t\tif (dbSym.getSource() == SourceType.DEFAULT) {\n\t\t\t\t\treturn false; // Can't remove default function symbol\n\t\t\t\t}\n\t\t\t\tname = SymbolUtilities.getDefaultFunctionName(address);\n\t\t\t\tparent = global;\n\t\t\t\tsource = SourceType.DEFAULT;\n\t\t\t}","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewSymbolTable.java#L86-L122","documentation":"Thrown as IllegalArgumentException by removeSymbolSpecial when the symbol looked up by ID from the trace's symbol manager is not identity-equal (==) to the passed symbol. This means the passed Symbol object does not originate from this trace — it belongs to another program/trace, so removing it via this view is invalid.","triggerScenarios":"Calling removeSymbolSpecial(sym) where sym was obtained from a different Program or trace than the current view, or is a stale/different symbol object with the same ID but different identity.","commonSituations":"Passing a static-program Symbol to the trace view's symbol table. Reusing symbol handles across multiple open traces. Operating on symbols after switching the active trace.","solutions":["Only pass symbols obtained from the same trace view's symbol table to removeSymbolSpecial.","Verify sym instanceof TraceSymbol and that sym.getProgram() / getID() resolves to this trace before calling.","Re-resolve the symbol by ID from the current trace's symbol manager before removing."],"exampleFix":"// before\nsymbolTable.removeSymbolSpecial(sym);\n\n// after\nif (sym instanceof TraceSymbol && sym.getID() != -1) {\n    AbstractDBTraceSymbol dbSym = trace.getSymbolManager().getSymbolByID(sym.getID());\n    if (sym == dbSym) {\n        symbolTable.removeSymbolSpecial(sym);\n    }\n}","handlingStrategy":"type-guard","validationCode":"// Re-resolve the symbol by ID from the current trace before removing\nif (sym instanceof TraceSymbol) {\n    AbstractDBTraceSymbol dbSym =\n        trace.getSymbolManager().getSymbolByID(sym.getID());\n    if (sym == dbSym) {\n        symbolTable.removeSymbolSpecial(sym);\n    }\n}","typeGuard":"static boolean isTraceSymbolOf(Symbol s, Trace trace) {\n    if (!(s instanceof TraceSymbol)) return false;\n    return trace.getSymbolManager().getSymbolByID(s.getID()) == s;\n}","tryCatchPattern":null,"preventionTips":["Only pass symbols obtained from the same trace view.","Re-resolve symbols by ID from the current trace before removal.","Do not reuse symbol handles across different traces."],"tags":["trace-modeling","symbol","identity","validation","ghidra"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}