{"record":{"id":"2bb63564bce89264","repo":"NationalSecurityAgency/ghidra","slug":"couldn-t-create-namespace-name-in-namesp","errorCode":null,"errorMessage":"Couldn't create namespace '\" + name + \"' in namespace '\" + resultParentNs.getName(true) + \"'.","messagePattern":"Couldn't create namespace '\" \\+ name \\+ \"' in namespace '\" \\+ resultParentNs\\.getName\\(true\\) \\+ \"'\\.","errorType":"exception","errorClass":"DuplicateNameException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/SymbolMerger.java","lineNumber":350,"sourceCode":"\t\t\t\t}\n\t\t\t\t// Found the equivalent namespace so return it.\n\t\t\t\treturn ns;\n\t\t\t}\n\t\t\t// Create it, since nothing with this conflict name.\n\t\t\tSymbol uniqueSymbol = createSymbol(uniqueSymbolName, st, resultAddr, resultParentNs,\n\t\t\t\tsrcPgm, srcSymID, source);\n\t\t\tif (uniqueSymbol != null) {\n\t\t\t\tObject obj = uniqueSymbol.getObject();\n\t\t\t\tif (obj instanceof Namespace) {\n\t\t\t\t\tif (!uniqueSymbolName.equals(name)) {\n\t\t\t\t\t\trenamedConflictIDs.add(uniqueSymbol.getID());\n\t\t\t\t\t}\n\t\t\t\t\treturn (Namespace) obj;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak; // Otherwise throw exception\n\t\t}\n\t\tthrow new DuplicateNameException(\"Couldn't create namespace '\" + name + \"' in namespace '\" +\n\t\t\tresultParentNs.getName(true) + \"'.\");\n\t}\n\n\t/**\n\t * Determine the type of changes to the symbols in the LATEST and MY (CheckedOut) program.\n\t * Changes can be symbol removed, added, changed, renamed, and set to primary.\n\t * @param monitor task monitor for displaying progress to the user\n\t * @throws CancelledException if the user cancels the merge.\n\t */\n\tprivate void setupSymbolChanges(TaskMonitor monitor) throws CancelledException {\n\n\t\tlong[] tempMyAddIDs = listingMergeMgr.myChanges.getSymbolAdditions();\n\t\tlong[] tempMyChangeIDs = listingMergeMgr.myChanges.getSymbolChanges();\n\t\tlong[] tempLatestAddIDs = listingMergeMgr.latestChanges.getSymbolAdditions();\n\t\tlong[] tempLatestChangeIDs = listingMergeMgr.latestChanges.getSymbolChanges();\n\n\t\tint max = tempMyAddIDs.length + tempMyChangeIDs.length + tempLatestAddIDs.length +\n\t\t\ttempLatestChangeIDs.length + 5;","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/SymbolMerger.java#L332-L368","documentation":"Thrown as DuplicateNameException by SymbolMerger when it cannot establish a namespace under resultParentNs — the lookup for an existing unique symbol of that name found nothing usable and the create path fell through to the trailing throw. It signals an unresolved namespace-name conflict during symbol/namespace merge where neither reuse nor rename succeeded.","triggerScenarios":"Merging symbols/namespaces where a namespace of the same name exists in the result program but is not a Namespace-typed symbol (uniqueSymbol.getObject() is not a Namespace), or where the unique-symbol lookup returned null and the create attempt was abandoned at the break.","commonSituations":"Both checked-out versions added or renamed a namespace identically; a class/namespace collision between the latest and my versions that the merger cannot auto-resolve; a corrupt symbol table where the expected namespace symbol is missing.","solutions":["Resolve the namespace-name conflict manually in the merge GUI before re-running, or choose the 'Use For All' option.","Pre-merge: rename one side's conflicting namespace so the names differ before merge.","Catch DuplicateNameException in automated merge tooling and surface it as a manual-conflict item rather than aborting.","Inspect resultParentNs to confirm it exists and is writable in the result program."],"exampleFix":"// before\n// merger.createNamespace(...) falls through to:\nthrow new DuplicateNameException(\"Couldn't create namespace '\" + name + \"' in namespace '\" + resultParentNs.getName(true) + \"'.\");\n\n// after — caller handles the conflict explicitly\ntry {\n    Namespace ns = merger.resolveOrCreateNamespace(resultParentNs, name);\n} catch (DuplicateNameException e) {\n    conflictQueue.add(new NamespaceConflict(resultParentNs, name));\n}","handlingStrategy":"try-catch","validationCode":"// before merging, check whether the namespace already exists as a Namespace\nSymbolTable st = resultPgm.getSymbolTable();\nSymbol existing = st.getSymbol(name, resultParentNs);\nif (existing == null || !(existing.getObject() instanceof Namespace)) {\n    // rename or create to avoid the fall-through throw\n}","typeGuard":"boolean canCreateNs = resultParentNs != null && (st.getSymbol(name, resultParentNs) == null || st.getSymbol(name, resultParentNs).getObject() instanceof Namespace);","tryCatchPattern":"try {\n    Namespace ns = merger.resolveOrCreateNamespace(resultParentNs, name);\n} catch (DuplicateNameException e) {\n    conflictQueue.add(new NamespaceConflict(resultParentNs, name));\n}","preventionTips":["Resolve namespace-name conflicts before merge (GUI or pre-rename).","Ensure resultParentNs exists and is writable.","Surface DuplicateNameException as a manual-conflict item in automation."],"tags":["ghidra","merge","symbol","namespace","duplicate-name"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}