NationalSecurityAgency/ghidra · error · IllegalArgumentException

Given symbol is not in this trace

Error message

Given symbol is not in this trace

What it means

Thrown by DBTraceSymbolManager.assertIsMine(Symbol): checkIsMine(symbol) returned null, i.e. the symbol is not an AbstractDBTraceSymbol that belongs to this trace. The trace refuses to operate on symbols from another trace or from the Program symbol table.

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/DBTraceSymbolManager.java:484

			return null;
		}
		return dbSym;
	}

	@Internal
	public DBTraceNamespaceSymbol assertIsMine(Namespace ns) {
		DBTraceNamespaceSymbol dbns = checkIsMine(ns);
		if (dbns == null) {
			throw new IllegalArgumentException("Given namespace is not in this trace");
		}
		return dbns;
	}

	@Internal
	public AbstractDBTraceSymbol assertIsMine(Symbol symbol) {
		AbstractDBTraceSymbol dbSym = checkIsMine(symbol);
		if (dbSym == null) {
			throw new IllegalArgumentException("Given symbol is not in this trace");
		}
		return dbSym;
	}

	protected static void assertValidName(String name) throws InvalidInputException {
		if (name == null || name.length() == 0 || !name.matches("\\p{Graph}+")) {
			throw new InvalidInputException(name);
		}
	}

	/**
	 * Checks for duplicate names, allowing {@link SymbolType#LABEL}
	 * 
	 * @param name the proposed name
	 * @param parent the parent namespace
	 * @throws DuplicateNameException if the name is a duplicate
	 */
	protected void assertUniqueName(String name, DBTraceNamespaceSymbol parent)

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Look the symbol up fresh in this trace by ID/address/name before operating on it.
  2. For cross-source operations, copy the symbol's properties (name, address, type, namespace) rather than the Symbol object itself.
  3. Guard with instanceof AbstractDBTraceSymbol and verify trace ownership before passing the symbol.
  4. Do not hold Symbol references past the trace's lifetime.

Example fix

// before
symMgr.removeSymbol(foreignSym);

// after
Symbol mine = symMgr.getSymbolByID(foreignSym.getID());
if (mine instanceof AbstractDBTraceSymbol) {
    symMgr.removeSymbol(mine);
}
Defensive patterns

Strategy: validation

Validate before calling

Symbol mine = symMgr.getSymbolByID(foreignSym.getID());
if (mine instanceof AbstractDBTraceSymbol) { /* safe */ }

Type guard

static boolean isMineSym(Trace trace, Symbol s) {
    return s instanceof AbstractDBTraceSymbol dbs && dbs.getTrace() == trace;
}

Prevention

When it happens

Trigger: Passing a Symbol obtained from a different Trace, a Program (e.g. program.getSymbolTable().getSymbols()), or a mock into a trace operation that validates symbol ownership.

Common situations: Symbol-moving/renaming utilities that take a Symbol from the program listing; reusing a Symbol reference after the owning trace is closed; test fakes that are not real DBTraceSymbols.

Related errors


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