{"record":{"id":"355343b5a12e36d0","repo":"NationalSecurityAgency/ghidra","slug":"given-namespace-is-not-part-of-this-trace","errorCode":null,"errorMessage":"Given namespace is not part of this trace","messagePattern":"Given namespace 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":80,"sourceCode":"\t\t}\n\t}\n\n\tprotected final DBTraceProgramView program;\n\tprotected final DBTraceSymbolManager symbolManager;\n\tprotected final DBTraceNamespaceSymbol global;\n\n\tpublic DBTraceProgramViewSymbolTable(DBTraceProgramView program) {\n\t\tthis.program = program;\n\t\tthis.symbolManager = program.trace.getSymbolManager();\n\t\tthis.global = symbolManager.getGlobalNamespace();\n\t}\n\n\tprotected TraceNamespaceSymbol assertTraceNamespace(Namespace ns) {\n\t\tif (ns == null) {\n\t\t\treturn symbolManager.getGlobalNamespace();\n\t\t}\n\t\tif (!(ns instanceof TraceNamespaceSymbol)) {\n\t\t\tthrow new IllegalArgumentException(\"Given namespace is not part of this trace\");\n\t\t}\n\t\treturn (TraceNamespaceSymbol) ns;\n\t}\n\n\t@Override\n\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","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewSymbolTable.java#L62-L98","documentation":"Thrown as IllegalArgumentException by assertTraceNamespace when the provided Namespace is not an instance of TraceNamespaceSymbol. The trace symbol table only manages trace-owned namespaces; a Namespace from a regular Program or a non-trace implementation cannot be used as a parent namespace in trace operations like createLabel or createClass.","triggerScenarios":"Calling createLabel(addr, name, namespace, source), createClass(namespace, name, source), createNameSpace, etc. with a Namespace object sourced from a static Program rather than the trace.","commonSituations":"Passing a Program's GlobalNamespace or a user namespace from the static program into trace symbol-creation calls. Reusing namespace handles across program and trace views.","solutions":["Use the trace's own global namespace (symbolTable.getGlobalNamespace() or symbolManager.getGlobalNamespace()) as the parent.","Type-check: verify namespace instanceof TraceNamespaceSymbol (or null for global) before use.","Map the static-program namespace to its trace equivalent before passing it."],"exampleFix":"// before\nSymbol s = symbolTable.createLabel(addr, name, staticProgramNs, SourceType.USER_DEFINED);\n\n// after\nNamespace traceNs = (ns instanceof TraceNamespaceSymbol || ns == null)\n    ? ns\n    : symbolTable.getGlobalNamespace();\nSymbol s = symbolTable.createLabel(addr, name, traceNs, SourceType.USER_DEFINED);","handlingStrategy":"type-guard","validationCode":"// Ensure the namespace is a trace namespace before use\nNamespace ns = (namespace instanceof TraceNamespaceSymbol || namespace == null)\n    ? namespace\n    : symbolTable.getGlobalNamespace();\nsymbolTable.createLabel(addr, name, ns, SourceType.USER_DEFINED);","typeGuard":"static boolean isTraceNamespace(Namespace ns) {\n    return ns == null || ns instanceof TraceNamespaceSymbol;\n}","tryCatchPattern":null,"preventionTips":["Always use the trace's own namespaces as parents.","Type-check Namespace objects before trace symbol operations.","Map static-program namespaces to trace equivalents before use."],"tags":["trace-modeling","namespace","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"}