{"record":{"id":"e5485a59f8423060","repo":"apache/pulsar","slug":"can-not-enable-for-all-producers-but-denies-for-re-e5485a","errorCode":null,"errorMessage":"Can not enable for all producers but denies for replicators","messagePattern":"Can not enable for all producers but denies for replicators","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java","lineNumber":2180,"sourceCode":"\n        @Option(names = { \"--disable\", \"-d\" }, description = \"Disable schema validation enforced\")\n        private boolean disable = false;\n\n        @Option(names = { \"--enable-for-replicator\" },\n                description = \"By default, brokers always allow replicator to register new compatible schemas even\"\n                + \" when auto updates are disabled, if you want to disable replicators to register compatible schemas,\"\n                + \" please set it to false\")\n        private Boolean enableForReplicator;\n\n        @Override\n        void run() throws PulsarAdminException {\n            String namespace = validateNamespace(namespaceName);\n\n            if (enable == disable) {\n                throw new ParameterException(\"Need to specify either --enable or --disable\");\n            }\n            if (enable && enableForReplicator != null && !enableForReplicator) {\n                throw new ParameterException(\"Can not enable for all producers but denies for replicators\");\n            }\n            getAdmin().namespaces().setIsAllowAutoUpdateSchema(namespace, enable, enableForReplicator);\n        }\n    }\n\n    @Command(description = \"Get the schema validation enforced\")\n    private class GetSchemaValidationEnforced extends CliCommand {\n        @Parameters(description = \"tenant/namespace\", arity = \"1\")\n        private String namespaceName;\n\n        @Option(names = { \"-ap\", \"--applied\" }, description = \"Get the applied policy of the namespace\")\n        private boolean applied = false;\n\n        @Override\n        void run() throws PulsarAdminException {\n            String namespace = validateNamespace(namespaceName);\n\n            System.out.println(getAdmin().namespaces().getSchemaValidationEnforced(namespace, applied));","sourceCodeStart":2162,"sourceCodeEnd":2198,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java#L2162-L2198","documentation":"Thrown by the schema auto-update command when the requested combination is logically contradictory: the main toggle is enabled (--enable, applying to all producers) but the replicator-specific flag explicitly denies auto-update for replicators. Since enabling for all producers includes replicators, denying them at the same time is rejected with this ParameterException before calling setIsAllowAutoUpdateSchema.","triggerScenarios":"Running the auto-update-schema command with --enable together with a --disable-for-replicator / enableForReplicator=false option.","commonSituations":"Misunderstanding the scoping of the replicator flag (it can only narrow a disabled setup or explicitly opt in); copying flags from two different examples into one command; template conditionals emitting both an enable and a replicator-deny flag.","solutions":["Use --enable without the replicator-deny flag (replicators will be included).","If replicators must be excluded, disable auto-update overall and configure per-namespace instead, or use the replicator-specific enable flag only with --disable.","Review scripted flag assembly so the main toggle and the replicator flag are consistent."],"exampleFix":"// before\npulsar-admin namespaces set-schema-auto-update-strategy public/default --enable --disable-for-replicator\n// after\npulsar-admin namespaces set-schema-auto-update-strategy public/default --enable","handlingStrategy":"validation","validationCode":"if [ \"$ENABLE\" = \"--enable\" ] && [ -n \"$REPLICATOR_FLAG\" ] && [ \"$REPLICATOR_FLAG\" = \"--disable-for-replicator\" ]; then\n  echo \"cannot enable for producers while denying replicators\"; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not combine --enable with a replicator-deny flag; enabling covers replicators.","Use the replicator-specific enable flag only in combination with --disable.","Review template conditionals that emit both scope flags."],"tags":["cli","parameter-validation","schema","pulsar-admin"],"backgroundTag":"conflicting-cli-flags","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"}