NationalSecurityAgency/ghidra · error · InvalidInputException
Couldn't get namespace '" + newSymbol.getParentNamespace().t
Error message
Couldn't get namespace '" + newSymbol.getParentNamespace().toString() + "' in result program.
What it means
Thrown as InvalidInputException by SymbolMerger.renameSymbol when DiffUtility.getNamespace(newSymbol.getParentNamespace(), oldProgram) returns null — i.e. the namespace that contains the symbol in the new/result program has no matching namespace in the old program. The rename cannot proceed because the source-side namespace context is missing.
Source
Thrown at Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/SymbolMerger.java:2283
* @param oldProgram the program containing the old symbol
* @param oldSymbol the old symbol
* @param newProgram the program containing the new symbol
* @param newSymbol the new symbol
* @throws DuplicateNameException
* @throws InvalidInputException
* @throws CircularDependencyException
*/
private void renameSymbol(Program oldProgram, Symbol oldSymbol, Program newProgram,
Symbol newSymbol)
throws DuplicateNameException, InvalidInputException, CircularDependencyException {
SourceType source = newSymbol.getSource();
String newName = newSymbol.getName();
Address addressInOldProgram =
SimpleDiffUtility.getCompatibleAddress(newProgram, newSymbol.getAddress(), oldProgram);
Namespace namespaceInOldProgram =
DiffUtility.getNamespace(newSymbol.getParentNamespace(), oldProgram);
if (namespaceInOldProgram == null) {
throw new InvalidInputException("Couldn't get namespace '" +
newSymbol.getParentNamespace().toString() + "' in result program.");
}
SymbolTable oldSymTab = oldProgram.getSymbolTable();
Symbol existingSymbol =
oldSymTab.getSymbol(newName, addressInOldProgram, namespaceInOldProgram);
if (oldSymbol == existingSymbol) {
return; // Already has correct name and scope.
}
// rename and then set namespace.
String oldName = oldSymbol.getName();
Namespace oldNamespace = oldSymbol.getParentNamespace();
boolean nameChanged = !newName.equals(oldName);
boolean scopeChanged = namespaceInOldProgram != oldNamespace;
String tempName = null;
if (nameChanged) {
try {
oldSymbol.setName(newName, source);View on GitHub (pinned to d5f144c24d)
Solutions
- Ensure the parent namespace exists in the old/target program before renaming — create it if missing.
- Pre-sync namespaces between programs (DiffUtility.getNamespace should resolve) before performing symbol renames.
- Catch InvalidInputException and skip/log the symbol rather than aborting the whole rename pass.
- Verify the namespace path is equivalent (case, scope) across both programs.
Example fix
// before
Namespace ns = DiffUtility.getNamespace(newSymbol.getParentNamespace(), oldProgram);
if (ns == null) {
throw new InvalidInputException("Couldn't get namespace '...'.");
}
// after — create the missing namespace first
Namespace ns = DiffUtility.getNamespace(newSymbol.getParentNamespace(), oldProgram);
if (ns == null) {
ns = oldProgram.getSymbolTable().createNamespace(
newSymbol.getParentNamespace().getName(),
DiffUtility.getNamespace(newSymbol.getParentNamespace().getParentNamespace(), oldProgram),
SourceType.ANALYSIS);
} Defensive patterns
Strategy: validation
Validate before calling
Namespace ns = DiffUtility.getNamespace(newSymbol.getParentNamespace(), oldProgram);
if (ns == null) {
// create the missing namespace before rename
ns = oldProgram.getSymbolTable().createNamespace(newSymbol.getParentNamespace().getName(),
DiffUtility.getNamespace(newSymbol.getParentNamespace().getParentNamespace(), oldProgram),
SourceType.ANALYSIS);
} Type guard
boolean nsResolves = DiffUtility.getNamespace(newSymbol.getParentNamespace(), oldProgram) != null;
Try / catch
try {
renameSymbol(oldProgram, oldSymbol, newProgram, newSymbol);
} catch (InvalidInputException e) {
// skip symbols whose namespace is missing in old program
} Prevention
- Sync namespaces between programs before symbol renames.
- Verify namespace paths match (case/scope) across programs.
- Create missing namespaces on demand rather than aborting.
When it happens
Trigger: Calling renameSymbol where the result program has a parent namespace that was never created (or was deleted) in the old program; the namespace lookup by DiffUtility found no equivalent namespace.
Common situations: Cross-program symbol sync where the target program is missing a namespace that exists in the source; merging after a namespace was removed on one side; stale symbol references to a namespace that no longer round-trips.
Related errors
- Couldn't create namespace '" + name + "' in namespace '" + r
- Given namespace is not part of this trace
- Given namespace is not in this trace
- Didn't remove external library {libName}
- Couldn't create symbol '" + mySym.getName(true) + "'.
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/304180aa79603379.
Report an issue: GitHub.