NationalSecurityAgency/ghidra · error · IllegalArgumentException

Given symbol is not part of this trace

Error message

Given symbol is not part of this trace

What it means

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.

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewSymbolTable.java:498

		}
		return symbolManager.getGlobalNamespace();
	}

	@Override
	public Iterator<GhidraClass> getClassNamespaces() {
		return DBTraceUtils.covariantIterator(symbolManager.classes().getAll(true).iterator());
	}

	@Override
	public GhidraClass createClass(Namespace parent, String name, SourceType source)
			throws DuplicateNameException, InvalidInputException {
		return symbolManager.classes().add(name, assertTraceNamespace(parent), source);
	}

	@Override
	public SymbolIterator getChildren(Symbol parentSymbol) {
		if (!(parentSymbol instanceof TraceSymbol)) {
			throw new IllegalArgumentException("Given symbol is not part of this trace");
		}
		if (!(parentSymbol instanceof TraceNamespaceSymbol)) {
			return new SymbolIteratorAdapter(Collections.emptyIterator());
		}
		TraceNamespaceSymbol parent = (TraceNamespaceSymbol) parentSymbol;
		return new SymbolIteratorAdapter(symbolManager.allSymbols().getChildren(parent).iterator());
	}

	@Override
	public Library createExternalLibrary(String name, SourceType source)
			throws DuplicateNameException, InvalidInputException {
		throw new UnsupportedOperationException();
	}

	@Override
	public Namespace createNameSpace(Namespace parent, String name, SourceType source)
			throws DuplicateNameException, InvalidInputException {
		return symbolManager.namespaces().add(name, assertTraceNamespace(parent), source);

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Guard the call: verify parentSymbol instanceof TraceSymbol before calling getChildren.
  2. Source parent symbols from the trace view's own symbol table.
  3. Skip or return an empty iterator for non-trace symbols instead of passing them in.

Example fix

// before
SymbolIterator it = symbolTable.getChildren(parentSymbol);

// after
if (!(parentSymbol instanceof TraceSymbol)) {
    return SymbolIterator.EMPTY_ITERATOR;
}
SymbolIterator it = symbolTable.getChildren(parentSymbol);
Defensive patterns

Strategy: type-guard

Validate before calling

// Only call getChildren on trace-owned symbols
if (parentSymbol instanceof TraceSymbol) {
    SymbolIterator it = symbolTable.getChildren(parentSymbol);
} else {
    // return empty iterator for non-trace symbols
}

Type guard

static boolean isTraceSymbol(Symbol s) {
    return s instanceof TraceSymbol;
}

Prevention

When it happens

Trigger: Calling getChildren(parentSymbol) with a Symbol object obtained from a static Program or a non-trace source.

Common situations: 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.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/1b10f7aa31499b8c. Report an issue: GitHub.