{"record":{"id":"5cf482f444f3bd45","repo":"apache/pulsar","slug":"namespaces-differ","errorCode":null,"errorMessage":"Namespaces differ","messagePattern":"Namespaces differ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java","lineNumber":991,"sourceCode":"            doPythonChecks(functionConfig);\n        } else {\n            throw new IllegalArgumentException(\"Function language runtime is either not set or cannot be determined\");\n        }\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<>());","sourceCodeStart":973,"sourceCodeEnd":1009,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java#L973-L1009","documentation":"validateUpdate enforces that a function's namespace cannot change on update. This error is thrown when the new config's namespace differs from the existing config's namespace for the function being updated.","triggerScenarios":"Calling the update function admin API with a FunctionConfig whose getNamespace() differs from the existing function's namespace (e.g. updating public/default function with namespace public/prod).","commonSituations":"Environment promotion workflows that swap namespace in a shared config; typo in namespace; moving a function between namespaces without first deleting it.","solutions":["Set the namespace in the update payload equal to the existing function's namespace.","To relocate the function, delete it and register it in the desired namespace.","Double-check tenant/namespace name casing and separators in the config."],"exampleFix":"// before\nupdateConfig.setNamespace(\"public/prod\"); // existing is public/default\n// after\nupdateConfig.setNamespace(existingConfig.getNamespace()); // \"public/default\"","handlingStrategy":"validation","validationCode":"if (!existingConfig.getNamespace().equals(newConfig.getNamespace())) {\n    throw new IllegalArgumentException(\"Update payload must reuse namespace \" + existingConfig.getNamespace());\n}","typeGuard":"boolean sameNamespace(FunctionConfig a, FunctionConfig b) {\n    return a.getNamespace().equals(b.getNamespace());\n}","tryCatchPattern":"try {\n    merged = FunctionConfigUtils.validateUpdate(existing, updated);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().equals(\"Namespaces differ\")) {\n        updated.setNamespace(existing.getNamespace());\n        merged = FunctionConfigUtils.validateUpdate(existing, updated);\n    } else { throw e; }\n}","preventionTips":["Fetch the current config before updating and base the payload on it.","Keep namespace constant across environment-deployment scripts for the same function.","Delete + recreate if namespace relocation is required."],"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"}