{"record":{"id":"f2ad0b1e9333569e","repo":"apache/pulsar","slug":"function-names-differ","errorCode":null,"errorMessage":"Function Names differ","messagePattern":"Function Names differ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java","lineNumber":994,"sourceCode":"        }\n    }\n\n    public static ExtractedFunctionDetails validateJavaFunction(FunctionConfig functionConfig,\n                                                                ValidatableFunctionPackage validatableFunctionPackage) {\n        doCommonChecks(functionConfig);\n        return doJavaChecks(functionConfig, validatableFunctionPackage);\n    }\n\n    public static FunctionConfig validateUpdate(FunctionConfig existingConfig, FunctionConfig newConfig) {\n        FunctionConfig mergedConfig = existingConfig.toBuilder().build();\n        if (!existingConfig.getTenant().equals(newConfig.getTenant())) {\n            throw new IllegalArgumentException(\"Tenants differ\");\n        }\n        if (!existingConfig.getNamespace().equals(newConfig.getNamespace())) {\n            throw new IllegalArgumentException(\"Namespaces differ\");\n        }\n        if (!existingConfig.getName().equals(newConfig.getName())) {\n            throw new IllegalArgumentException(\"Function Names differ\");\n        }\n        if (!StringUtils.isEmpty(newConfig.getClassName())) {\n            mergedConfig.setClassName(newConfig.getClassName());\n        }\n\n        if (!StringUtils.isEmpty(newConfig.getJar())) {\n            mergedConfig.setJar(newConfig.getJar());\n        }\n\n        if (newConfig.getInputSpecs() == null) {\n            newConfig.setInputSpecs(new HashMap<>());\n        }\n\n        if (mergedConfig.getInputSpecs() == null) {\n            mergedConfig.setInputSpecs(new HashMap<>());\n        }\n\n        if (newConfig.getInputs() != null) {","sourceCodeStart":976,"sourceCodeEnd":1012,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java#L976-L1012","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Keep the function name identical when updating","Delete and recreate with the new name instead"],"exampleFix":"// before\nupdateConfig.setName(\"exclamation-v2\"); // existing name: exclamation\n// after\nupdateConfig.setName(existingConfig.getName()); // \"exclamation\"","handlingStrategy":"validation","validationCode":"if (!existingConfig.getName().equals(newConfig.getName())) {\n    throw new IllegalArgumentException(\"Update payload must reuse function name \" + existingConfig.getName());\n}","typeGuard":"boolean sameName(FunctionConfig a, FunctionConfig b) {\n    return a.getName().equals(b.getName());\n}","tryCatchPattern":"try {\n    merged = FunctionConfigUtils.validateUpdate(existing, updated);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().equals(\"Function Names differ\")) {\n        updated.setName(existing.getName());\n        merged = FunctionConfigUtils.validateUpdate(existing, updated);\n    } else { throw e; }\n}","preventionTips":["Source the function name from a single constant/CLI flag used in both create and update.","Do not encode versions in the function name if you plan to update in place.","For renames, always delete + create."],"tags":["pulsar-functions","immutable-field","update-validation"],"backgroundTag":"immutable-field-update-rejected","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}