{"record":{"id":"9c2e2f7b248d88a1","repo":"NationalSecurityAgency/ghidra","slug":"cannot-modify-the-global-namespace","errorCode":null,"errorMessage":"Cannot modify the global namespace","messagePattern":"Cannot modify the global namespace","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/AbstractDBTraceSymbol.java","lineNumber":139,"sourceCode":"\t\tif (!Objects.equals(this.getParentSymbol(), that.getParentSymbol())) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t@Override\n\tpublic int hashCode() {\n\t\treturn Long.hashCode(getID());\n\t}\n\n\t@Override\n\tpublic String toString() {\n\t\treturn name;\n\t}\n\n\tprotected void assertNotGlobal() {\n\t\tif (isGlobal()) {\n\t\t\tthrow new UnsupportedOperationException(\"Cannot modify the global namespace\");\n\t\t}\n\t}\n\n\tprotected DBTraceNamespaceSymbol assertIsNamespace(AbstractDBTraceSymbol symbol) {\n\t\tassert symbol != null;\n\t\tif (!(symbol instanceof DBTraceNamespaceSymbol)) {\n\t\t\tthrow new AssertionError(\n\t\t\t\t\"Trace database corrupted. Symbol has a non-namespace parent.\");\n\t\t}\n\t\treturn (DBTraceNamespaceSymbol) symbol;\n\t}\n\n\t@Override\n\tprotected void fresh(boolean created) throws IOException {\n\t\tif (created) {\n\t\t\treturn;\n\t\t}\n","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/AbstractDBTraceSymbol.java#L121-L157","documentation":"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.","triggerScenarios":"Calling setName / setParent / remove on the symbol returned by getGlobalNamespace(). Attempting to delete the global namespace symbol.","commonSituations":"Scripts that walk up parent symbols and call setName on the root; refactoring tools that operate on an arbitrary symbol without checking isGlobal().","solutions":["Guard with: if (!symbol.isGlobal()) symbol.setName(...).","Operate on a real namespace child, not the global namespace itself.","When iterating parents, stop before the global namespace."],"exampleFix":"// before\nnsSymbol.setName(\"renamed\", SourceType.USER_DEFINED);\n// after\nif (!nsSymbol.isGlobal()) {\n    nsSymbol.setName(\"renamed\", SourceType.USER_DEFINED);\n}","handlingStrategy":"validation","validationCode":"if (!symbol.isGlobal()) {\n    symbol.setName(name, source);\n}","typeGuard":"static boolean isMutableSymbol(Symbol s) { return !s.isGlobal(); }","tryCatchPattern":null,"preventionTips":["Never mutate the global namespace symbol.","Stop parent walks before the global namespace."],"tags":["symbol","namespace","immutable","unsupported-operation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}