NationalSecurityAgency/ghidra · error · IllegalArgumentException
Given namespace is not part of this trace
Error message
Given namespace is not part of this trace
What it means
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.
Source
Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewSymbolTable.java:80
}
}
protected final DBTraceProgramView program;
protected final DBTraceSymbolManager symbolManager;
protected final DBTraceNamespaceSymbol global;
public DBTraceProgramViewSymbolTable(DBTraceProgramView program) {
this.program = program;
this.symbolManager = program.trace.getSymbolManager();
this.global = symbolManager.getGlobalNamespace();
}
protected TraceNamespaceSymbol assertTraceNamespace(Namespace ns) {
if (ns == null) {
return symbolManager.getGlobalNamespace();
}
if (!(ns instanceof TraceNamespaceSymbol)) {
throw new IllegalArgumentException("Given namespace is not part of this trace");
}
return (TraceNamespaceSymbol) ns;
}
@Override
public Symbol createLabel(Address addr, String name, SourceType source)
throws InvalidInputException {
return symbolManager.labels().create(program.snap, addr, name, global, source);
}
@Override
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
throws InvalidInputException {
return symbolManager.labels()
.create(program.snap, addr, name, assertTraceNamespace(namespace), source);
}
@OverrideView on GitHub (pinned to d5f144c24d)
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.
Example fix
// before
Symbol s = symbolTable.createLabel(addr, name, staticProgramNs, SourceType.USER_DEFINED);
// after
Namespace traceNs = (ns instanceof TraceNamespaceSymbol || ns == null)
? ns
: symbolTable.getGlobalNamespace();
Symbol s = symbolTable.createLabel(addr, name, traceNs, SourceType.USER_DEFINED); Defensive patterns
Strategy: type-guard
Validate before calling
// Ensure the namespace is a trace namespace before use
Namespace ns = (namespace instanceof TraceNamespaceSymbol || namespace == null)
? namespace
: symbolTable.getGlobalNamespace();
symbolTable.createLabel(addr, name, ns, SourceType.USER_DEFINED); Type guard
static boolean isTraceNamespace(Namespace ns) {
return ns == null || ns instanceof TraceNamespaceSymbol;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Given symbol is not part of this trace
- Given bookmark is not part of this trace
- The given symbol is not part of this trace
- Given namespace is not in this trace
- More than one state is present in
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/355343b5a12e36d0.
Report an issue: GitHub.