{"record":{"id":"3162a1491db95b55","repo":"apache/pulsar","slug":"brokerdeleteinactivetopicsenabled-and-brokerclosei","errorCode":null,"errorMessage":"brokerDeleteInactiveTopicsEnabled and brokerCloseInactiveTopicsEnabled are mutually exclusive. Enable at most one of them.","messagePattern":"brokerDeleteInactiveTopicsEnabled and brokerCloseInactiveTopicsEnabled are mutually exclusive\\. Enable at most one of them\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java","lineNumber":907,"sourceCode":"                    >= (config.getDefaultRetentionSizeInMB() * 1024L * 1024L)) {\n                throw new IllegalArgumentException(String.format(\"The retention size must > the backlog quota limit \"\n                                + \"size, but the configured backlog quota limit bytes is %d, the retention size is %d\",\n                        config.getBacklogQuotaDefaultLimitBytes(),\n                        config.getDefaultRetentionSizeInMB() * 1024L * 1024L));\n            }\n\n            if (config.getDefaultRetentionTimeInMinutes() > 0\n                    && config.getBacklogQuotaDefaultLimitSecond() > 0\n                    && config.getBacklogQuotaDefaultLimitSecond() >= config.getDefaultRetentionTimeInMinutes() * 60) {\n                throw new IllegalArgumentException(String.format(\"The retention time must > the backlog quota limit \"\n                                + \"time, but the configured backlog quota limit time duration is %d, \"\n                                + \"the retention time duration is %d\",\n                        config.getBacklogQuotaDefaultLimitSecond(),\n                        config.getDefaultRetentionTimeInMinutes() * 60));\n            }\n\n            if (config.isBrokerDeleteInactiveTopicsEnabled() && config.isBrokerCloseInactiveTopicsEnabled()) {\n                throw new IllegalArgumentException(\n                        \"brokerDeleteInactiveTopicsEnabled and brokerCloseInactiveTopicsEnabled are mutually \"\n                                + \"exclusive. Enable at most one of them.\");\n            }\n\n            if (config.isBrokerCloseInactiveTopicsEnabled()\n                    && config.getBrokerDeleteInactiveTopicsMode()\n                            != InactiveTopicDeleteMode.delete_when_no_subscriptions) {\n                throw new IllegalArgumentException(\n                        \"brokerCloseInactiveTopicsEnabled only supports brokerDeleteInactiveTopicsMode=\"\n                                + \"delete_when_no_subscriptions. Under delete_when_subscriptions_caught_up a topic \"\n                                + \"whose subscriptions are caught up is inactive even while consumers are still \"\n                                + \"connected, so closing it would repeatedly unload and reload the topic.\");\n            }\n\n            openTelemetryTopicStats = new OpenTelemetryTopicStats(this);\n            openTelemetryConsumerStats = new OpenTelemetryConsumerStats(this);\n            openTelemetryProducerStats = new OpenTelemetryProducerStats(this);\n            openTelemetryReplicatorStats = new OpenTelemetryReplicatorStats(this);","sourceCodeStart":889,"sourceCodeEnd":925,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java#L889-L925","documentation":"This IllegalArgumentException is thrown at broker startup when both brokerDeleteInactiveTopicsEnabled and brokerCloseInactiveTopicsEnabled are set to true. The two features are alternative ways of reclaiming inactive topics (deleting vs closing/unloading them), so enabling both is contradictory and the broker refuses to start rather than picking one arbitrarily.","triggerScenarios":"Starting a broker with isBrokerDeleteInactiveTopicsEnabled()==true AND isBrokerCloseInactiveTopicsEnabled()==true in the service configuration, e.g. after enabling the newer close-inactive-topics feature without disabling the legacy delete flag.","commonSituations":"Configuration merges or version upgrades where a new brokerCloseInactiveTopicsEnabled=true line is added while the older brokerDeleteInactiveTopicsEnabled=true is left in place; templated Helm/env config that sets both flags.","solutions":["Disable one of the two flags: set brokerDeleteInactiveTopicsEnabled=false if you want closing, or brokerCloseInactiveTopicsEnabled=false if you want deletion.","Decide based on goal: use delete to remove inactive topics entirely, use close to unload them (with a grace period) while keeping metadata.","Audit broker.conf, env-var overrides, and framework templates so only one flag is set to true.","Restart the broker and confirm startup passes validation."],"exampleFix":"// before (broker.conf)\nbrokerDeleteInactiveTopicsEnabled=true\nbrokerCloseInactiveTopicsEnabled=true\n// after\nbrokerDeleteInactiveTopicsEnabled=false\nbrokerCloseInactiveTopicsEnabled=true","handlingStrategy":"validation","validationCode":"// before broker start (Java)\nif (conf.isBrokerDeleteInactiveTopicsEnabled() && conf.isBrokerCloseInactiveTopicsEnabled()) {\n    throw new IllegalArgumentException(\n        \"Enable at most one of brokerDeleteInactiveTopicsEnabled / brokerCloseInactiveTopicsEnabled\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    pulsar.start();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"brokerDeleteInactiveTopicsEnabled and brokerCloseInactiveTopicsEnabled are mutually exclusive\")) {\n        // fix broker.conf: set exactly one of the two flags to true, then retry\n    } else {\n        throw e;\n    }\n}","preventionTips":["Enable at most one of the two inactive-topic flags in any broker config template.","Search Helm charts/env files for both keys when upgrading brokers.","Prefer brokerCloseInactiveTopicsEnabled for unload-style reclamation; otherwise use the delete flag.","Document the chosen policy in your deployment repo so future edits don't re-enable both."],"tags":["broker","configuration","startup","conflicting-flags","topics"],"backgroundTag":"invalid-configuration","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}