NationalSecurityAgency/ghidra · error · UnsupportedOperationException

Cannot modify the global namespace

Error message

Cannot modify the global namespace

What it means

Thrown as UnsupportedOperationException by AbstractDBTraceSymbol.assertNotGlobal when an operation that would mutate a symbol is attempted on the global namespace symbol. The global namespace is the immutable root of every trace's symbol tree and cannot be renamed, moved, deleted, or reparented. This is a hard contract: global is special.

Source

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

		if (!Objects.equals(this.getParentSymbol(), that.getParentSymbol())) {
			return false;
		}
		return true;
	}

	@Override
	public int hashCode() {
		return Long.hashCode(getID());
	}

	@Override
	public String toString() {
		return name;
	}

	protected void assertNotGlobal() {
		if (isGlobal()) {
			throw new UnsupportedOperationException("Cannot modify the global namespace");
		}
	}

	protected DBTraceNamespaceSymbol assertIsNamespace(AbstractDBTraceSymbol symbol) {
		assert symbol != null;
		if (!(symbol instanceof DBTraceNamespaceSymbol)) {
			throw new AssertionError(
				"Trace database corrupted. Symbol has a non-namespace parent.");
		}
		return (DBTraceNamespaceSymbol) symbol;
	}

	@Override
	protected void fresh(boolean created) throws IOException {
		if (created) {
			return;
		}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Guard with: if (!symbol.isGlobal()) symbol.setName(...).
  2. Operate on a real namespace child, not the global namespace itself.
  3. When iterating parents, stop before the global namespace.

Example fix

// before
nsSymbol.setName("renamed", SourceType.USER_DEFINED);
// after
if (!nsSymbol.isGlobal()) {
    nsSymbol.setName("renamed", SourceType.USER_DEFINED);
}
Defensive patterns

Strategy: validation

Validate before calling

if (!symbol.isGlobal()) {
    symbol.setName(name, source);
}

Type guard

static boolean isMutableSymbol(Symbol s) { return !s.isGlobal(); }

Prevention

When it happens

Trigger: Calling setName / setParent / remove on the symbol returned by getGlobalNamespace(). Attempting to delete the global namespace symbol.

Common situations: Scripts that walk up parent symbols and call setName on the root; refactoring tools that operate on an arbitrary symbol without checking isGlobal().

Related errors


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