apache/pulsar · error · IllegalArgumentException

Function Names differ

Error message

Function Names differ

What it means

FunctionConfigUtils.validateUpdate refuses an update that changes the function's name: updates must keep the same identity (tenant/namespace/name), and the new config's name differs from the existing one.

Source

Thrown at pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java:994

        }
    }

    public static ExtractedFunctionDetails validateJavaFunction(FunctionConfig functionConfig,
                                                                ValidatableFunctionPackage validatableFunctionPackage) {
        doCommonChecks(functionConfig);
        return doJavaChecks(functionConfig, validatableFunctionPackage);
    }

    public static FunctionConfig validateUpdate(FunctionConfig existingConfig, FunctionConfig newConfig) {
        FunctionConfig mergedConfig = existingConfig.toBuilder().build();
        if (!existingConfig.getTenant().equals(newConfig.getTenant())) {
            throw new IllegalArgumentException("Tenants differ");
        }
        if (!existingConfig.getNamespace().equals(newConfig.getNamespace())) {
            throw new IllegalArgumentException("Namespaces differ");
        }
        if (!existingConfig.getName().equals(newConfig.getName())) {
            throw new IllegalArgumentException("Function Names differ");
        }
        if (!StringUtils.isEmpty(newConfig.getClassName())) {
            mergedConfig.setClassName(newConfig.getClassName());
        }

        if (!StringUtils.isEmpty(newConfig.getJar())) {
            mergedConfig.setJar(newConfig.getJar());
        }

        if (newConfig.getInputSpecs() == null) {
            newConfig.setInputSpecs(new HashMap<>());
        }

        if (mergedConfig.getInputSpecs() == null) {
            mergedConfig.setInputSpecs(new HashMap<>());
        }

        if (newConfig.getInputs() != null) {

View on GitHub (pinned to 820761864e)

Solutions

  1. Keep the function name identical when updating
  2. Delete and recreate with the new name instead

Example fix

// before
updateConfig.setName("exclamation-v2"); // existing name: exclamation
// after
updateConfig.setName(existingConfig.getName()); // "exclamation"
Defensive patterns

Strategy: validation

Validate before calling

if (!existingConfig.getName().equals(newConfig.getName())) {
    throw new IllegalArgumentException("Update payload must reuse function name " + existingConfig.getName());
}

Type guard

boolean sameName(FunctionConfig a, FunctionConfig b) {
    return a.getName().equals(b.getName());
}

Try / catch

try {
    merged = FunctionConfigUtils.validateUpdate(existing, updated);
} catch (IllegalArgumentException e) {
    if (e.getMessage().equals("Function Names differ")) {
        updated.setName(existing.getName());
        merged = FunctionConfigUtils.validateUpdate(existing, updated);
    } else { throw e; }
}

Prevention

When it happens

Trigger: Calling the update function admin API where newConfig.getName() != existingConfig.getName(), e.g. renaming my-function to my-function-v2 via update instead of create.

Common situations: Versioned naming schemes that bump the name on each deploy; renaming to 'fix' a typo via update; template substitutions changing the function name between releases.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/f2ad0b1e9333569e. Report an issue: GitHub.