{"record":{"id":"3711da03399641b3","repo":"apache/pulsar","slug":"either-compatibility-or-disabled-must-be-speci","errorCode":null,"errorMessage":"Either --compatibility or --disabled must be specified","messagePattern":"Either --compatibility or --disabled must be specified","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java","lineNumber":2093,"sourceCode":"        @Override\n        @SuppressWarnings(\"deprecation\")\n        void run() throws PulsarAdminException {\n            String namespace = validateNamespace(namespaceName);\n\n            SchemaAutoUpdateCompatibilityStrategy strategy = null;\n            String strategyStr = strategyParam != null ? strategyParam.toUpperCase() : \"\";\n            if (disabled) {\n                strategy = SchemaAutoUpdateCompatibilityStrategy.AutoUpdateDisabled;\n            } else if (strategyStr.equals(\"FULL\")) {\n                strategy = SchemaAutoUpdateCompatibilityStrategy.Full;\n            } else if (strategyStr.equals(\"BACKWARD\")) {\n                strategy = SchemaAutoUpdateCompatibilityStrategy.Backward;\n            } else if (strategyStr.equals(\"FORWARD\")) {\n                strategy = SchemaAutoUpdateCompatibilityStrategy.Forward;\n            } else if (strategyStr.equals(\"NONE\")) {\n                strategy = SchemaAutoUpdateCompatibilityStrategy.AlwaysCompatible;\n            } else {\n                throw new ParameterException(\"Either --compatibility or --disabled must be specified\");\n            }\n            getAdmin().namespaces().setSchemaAutoUpdateCompatibilityStrategy(namespace, strategy);\n        }\n    }\n\n    @Command(description = \"Get the schema compatibility strategy for a namespace\")\n    private class GetSchemaCompatibilityStrategy extends CliCommand {\n        @Parameters(description = \"tenant/namespace\", arity = \"1\")\n        private String namespaceName;\n\n        @Override\n        void run() throws PulsarAdminException {\n            String namespace = validateNamespace(namespaceName);\n            System.out.println(getAdmin().namespaces().getSchemaCompatibilityStrategy(namespace)\n                    .toString().toUpperCase());\n        }\n    }\n","sourceCodeStart":2075,"sourceCodeEnd":2111,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java#L2075-L2111","documentation":"Thrown by the legacy 'set-schema-compatibility-strategy' namespace command when the strategy string does not match any of the hardcoded aliases it recognizes (BACKWARD, FORWARD, NONE, etc.). The command only maps a fixed set of legacy names to SchemaAutoUpdateCompatibilityStrategy values and rejects anything else with this generic message. Note NONE maps to AlwaysCompatible, which surprises many users.","triggerScenarios":"Running the legacy set-schema-compatibility-strategy command with a value not in its hardcoded list (e.g. 'always_incompatible', 'FULL', 'UNDEFINED', lowercase 'backward'), or an empty string.","commonSituations":"Using values valid for the newer set-schema-compatibility-strategy (SchemaCompatibilityStrategy enum: ALWAYS_COMPATIBLE, BACKWARD_TRANSITIVE, FULL, etc.) on the legacy command; case mismatch; reading docs for the modern command and applying them here.","solutions":["Use one of the legacy-accepted values: BACKWARD, FORWARD, NONE (meaning always-compatible) — uppercase exactly as documented.","Prefer the newer command based on SchemaCompatibilityStrategy (it accepts all enum values and gives a clearer error), e.g. set-schema-compatibility-strategy with --compatibility FULL_TRANSITIVE where available.","Check the command's help output for the exact accepted set before scripting."],"exampleFix":"// before\npulsar-admin namespaces set-schema-compatibility-strategy public/default --compatibility FULL\n// after\npulsar-admin namespaces set-schema-compatibility-strategy public/default --compatibility BACKWARD","handlingStrategy":"validation","validationCode":"S=\"$COMPAT\"\nif [[ ! \"$S\" =~ ^(BACKWARD|FORWARD|NONE)$ ]]; then echo \"legacy command accepts only BACKWARD, FORWARD, NONE (got: $S)\"; exit 1; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["On the legacy command use only BACKWARD, FORWARD, or NONE (NONE = always compatible).","Remember the mapping NONE -> AlwaysCompatible when migrating.","Prefer the modern SchemaCompatibilityStrategy-based command for values like FULL or *_TRANSITIVE."],"tags":["cli","enum-value","schema","pulsar-admin"],"backgroundTag":"invalid-enum-value","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"}