{"record":{"id":"68f287e7078731d4","repo":"apache/pulsar","slug":"autoack-cannot-be-altered","errorCode":null,"errorMessage":"AutoAck cannot be altered","messagePattern":"AutoAck cannot be altered","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java","lineNumber":1093,"sourceCode":"            throw new IllegalArgumentException(\"Retain Key Ordering cannot be altered\");\n        }\n        if (!StringUtils.isEmpty(newConfig.getOutput())) {\n            mergedConfig.setOutput(newConfig.getOutput());\n        }\n        if (newConfig.getUserConfig() != null) {\n            mergedConfig.setUserConfig(newConfig.getUserConfig());\n        }\n        if (newConfig.getSecrets() != null) {\n            mergedConfig.setSecrets(newConfig.getSecrets());\n        }\n        if (newConfig.getRuntime() != null && !newConfig.getRuntime().equals(existingConfig.getRuntime())) {\n            throw new IllegalArgumentException(\"Runtime cannot be altered\");\n        }\n        @SuppressWarnings(\"deprecation\")\n        boolean autoAckChanged = newConfig.getAutoAck() != null\n                && !newConfig.getAutoAck().equals(existingConfig.getAutoAck());\n        if (autoAckChanged) {\n            throw new IllegalArgumentException(\"AutoAck cannot be altered\");\n        }\n        if (newConfig.getMaxMessageRetries() != null) {\n            mergedConfig.setMaxMessageRetries(newConfig.getMaxMessageRetries());\n        }\n        if (!StringUtils.isEmpty(newConfig.getDeadLetterTopic())) {\n            mergedConfig.setDeadLetterTopic(newConfig.getDeadLetterTopic());\n        }\n        if (!StringUtils.isEmpty(newConfig.getSubName()) && !newConfig.getSubName()\n                .equals(existingConfig.getSubName())) {\n            throw new IllegalArgumentException(\"Subscription Name cannot be altered\");\n        }\n        if (newConfig.getParallelism() != null) {\n            mergedConfig.setParallelism(newConfig.getParallelism());\n        }\n        if (newConfig.getResources() != null) {\n            mergedConfig\n                    .setResources(ResourceConfigUtils.merge(existingConfig.getResources(), newConfig.getResources()));\n        }","sourceCodeStart":1075,"sourceCodeEnd":1111,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java#L1075-L1111","documentation":"FunctionConfigUtils.validateUpdate rejects changing the autoAck setting on an existing function: autoAck is immutable after creation because it changes acknowledgement semantics for in-flight messages.","triggerScenarios":"Updating a function where getAutoAck() is non-null and differs from the existing config's autoAck value.","commonSituations":"Old configs or legacy tooling that still set autoAck; SDK clients carrying autoAck=true/false defaults from older Pulsar versions into update requests.","solutions":["Keep autoAck unchanged in the update request","Recreate the function if autoAck must change"],"exampleFix":"// before\nupdate.setAutoAck(false); // deprecated + differs -> thrown\n// after\nupdate.setAutoAck(null); // leave deprecated field unset","handlingStrategy":"validation","validationCode":"if (update.getAutoAck() != null) {\n    update.setAutoAck(null); // deprecated field; leave unset on updates\n}","typeGuard":null,"tryCatchPattern":"try {\n    admin.functions().updateFunction(update, pkgFile);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"AutoAck\")) { /* clear autoAck and retry */ }\n    else throw e;\n}","preventionTips":["Stop using the deprecated autoAck field entirely.","Purge autoAck from stored/template configs.","Migrate tooling to current FunctionConfig fields."],"tags":["pulsar-functions","config-update","deprecated"],"backgroundTag":"immutable-config-field","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"}