NationalSecurityAgency/ghidra · error · InvalidInputException

Function name conflict occurred when applying function signa

Error message

Function name conflict occurred when applying function signature.

What it means

Thrown by ApplyFunctionSignatureCmd.setName when function.setName raises DuplicateNameException. This happens when the target name already exists as a non-removable symbol in the same namespace (the command only removes a conflicting LABEL symbol first, not functions or other types). The DuplicateNameException is wrapped as InvalidInputException with this message.

Source

Thrown at Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/ApplyFunctionSignatureCmd.java:398

		SymbolUtilities.validateName(name);
		if (function.getName().equals(name)) {
			return;
		}

		if (functionRenameOption == FunctionRenameOption.RENAME_IF_DEFAULT &&
			function.getSymbol().getSource() != SourceType.DEFAULT) {
			// not default and we are not forcing the rename
			return;
		}

		try {
			removeCodeSymbol(function.getEntryPoint(), name, function.getParentNamespace());
			function.setName(name, source);
		}
		catch (DuplicateNameException e) {
			// unexpected
			throw new InvalidInputException(
				"Function name conflict occurred when applying function signature.");
		}
	}

	/**
	 * The C language assumes array datatypes are passed simply as pointers (by reference) even though
	 * other datatypes are passed by value.  This routine converts the datatype to the appropriate pointer
	 * in situations where we need to get at the exact type being passed by "value"
	 * @param dt the type
	 * @param dtm the data type manager
	 * @return the updated type
	 */
	private static DataType settleCDataType(DataType dt, DataTypeManager dtm) {
		if (dt == null) {
			return null;
		}
		DataType baseType = dt;
		if (baseType instanceof TypedefDataType) {

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Rename or remove the conflicting non-label symbol in the namespace before applying the signature.
  2. Use FunctionRenameOption.NO_CHANGE if you do not need to rename.
  3. Namespace the new function differently so its name is unique.
  4. Catch InvalidInputException, inspect the namespace, and resolve the collision manually.

Example fix

// before
new ApplyFunctionSignatureCmd(entry, sig, source,
    false, false, handler, FunctionRenameOption.RENAME_IF_DEFAULT).applyTo(program);
// name collision with a non-label symbol -> InvalidInputException

// after - choose a unique namespace or skip rename
Function f = program.getFunctionManager().getFunctionContaining(entry);
Namespace ns = f.getParentNamespace();
if (program.getSymbolTable().getSymbol(sig.getName(), f.getEntryPoint(), ns) != null
    && /* not a label */) {
    // skip rename: build sig with FunctionRenameOption.NO_CHANGE
}
new ApplyFunctionSignatureCmd(entry, sig, source, false, false, handler,
    FunctionRenameOption.NO_CHANGE).applyTo(program);
Defensive patterns

Strategy: validation

Validate before calling

SymbolTable st = program.getSymbolTable();
Symbol existing = st.getSymbol(name, function.getEntryPoint(), function.getParentNamespace());
if (existing != null && existing.getSymbolType() != SymbolType.LABEL) {
    // non-label collision - rename or use NO_CHANGE
}

Type guard

boolean isNameAvailableForFunction(Program p, Function f, String name) {
    Symbol s = p.getSymbolTable().getSymbol(name, f.getEntryPoint(), f.getParentNamespace());
    return s == null || s.getSymbolType() == SymbolType.LABEL;
}

Try / catch

try {
    cmd.applyTo(program);
} catch (Exception e) {
    if (e.getMessage().contains("Function name conflict")) {
        // use FunctionRenameOption.NO_CHANGE or pick a unique name
    } else throw e;
}

Prevention

When it happens

Trigger: Applying a signature whose function name collides with an existing symbol in the same namespace that is not a label (e.g. another function, a class, a namespace). removeCodeSymbol only deletes a LABEL; any other SymbolType survives and setName then conflicts.

Common situations: Two functions sharing a name in the same namespace. Applying a signature that names a function identically to an existing class/namespace symbol. Importing a signature set with duplicate names.

Related errors


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