{"record":{"id":"6f9348de7150d9d3","repo":"apache/pulsar","slug":"illegal-schema-compatibility-strategy-s-possible","errorCode":null,"errorMessage":"Illegal schema compatibility strategy %s. Possible values: %s","messagePattern":"Illegal schema compatibility strategy (.+?)\\. Possible values: (.+?)","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java","lineNumber":2135,"sourceCode":"        @Option(names = { \"--compatibility\", \"-c\" },\n                description = \"Compatibility level required for new schemas created via a Producer. \"\n                        + \"Possible values (FULL, BACKWARD, FORWARD, \"\n                        + \"UNDEFINED, BACKWARD_TRANSITIVE, \"\n                        + \"FORWARD_TRANSITIVE, FULL_TRANSITIVE, \"\n                        + \"ALWAYS_INCOMPATIBLE,\"\n                        + \"ALWAYS_COMPATIBLE).\")\n        private String strategyParam = null;\n\n        @Override\n        void run() throws PulsarAdminException {\n            String namespace = validateNamespace(namespaceName);\n\n            String strategyStr = strategyParam != null ? strategyParam.toUpperCase() : \"\";\n            SchemaCompatibilityStrategy strategy;\n            try {\n                strategy = SchemaCompatibilityStrategy.valueOf(strategyStr);\n            } catch (IllegalArgumentException exception) {\n                throw new ParameterException(String.format(\"Illegal schema compatibility strategy %s. \"\n                        + \"Possible values: %s\", strategyStr, Arrays.toString(SchemaCompatibilityStrategy.values())));\n            }\n            getAdmin().namespaces().setSchemaCompatibilityStrategy(namespace, strategy);\n        }\n    }\n\n    @Command(description = \"Get the namespace whether allow auto update schema\")\n    private class GetIsAllowAutoUpdateSchema 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\n            System.out.println(getAdmin().namespaces().getIsAllowAutoUpdateSchema(namespace));\n        }\n    }","sourceCodeStart":2117,"sourceCodeEnd":2153,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java#L2117-L2153","documentation":"Thrown by the modern schema compatibility command when the --compatibility value cannot be parsed as a SchemaCompatibilityStrategy enum constant. The code uppercases the input, calls SchemaCompatibilityStrategy.valueOf, and converts the IllegalArgumentException into a ParameterException listing all valid enum values. This is strict enum validation performed client-side before the admin API call.","triggerScenarios":"Passing an invalid value to the schema compatibility flag (e.g. 'backward-compat', 'BACKWARDTRANSITIVE', 'none') or leaving it empty so strategyStr is ''.","commonSituations":"Hyphenated or shorthand names not in the enum; missing an underscore (BACKWARDTRANSITIVE vs BACKWARD_TRANSITIVE); using legacy values like ALWAYS_COMPATIBLE spelled differently across Pulsar versions (ALWAYS_COMPATIBLE vs AlwaysCompatible legacy name).","solutions":["Use an exact SchemaCompatibilityStrategy value, e.g. ALWAYS_COMPATIBLE, BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, FULL_TRANSITIVE, NONE (uppercase).","Copy the possible-values list from the error message or the command --help output.","Trim whitespace and strip hyphens from scripted values before passing the flag."],"exampleFix":"// before\npulsar-admin namespaces set-schema-compatibility-strategy public/default --compatibility backward-transitive\n// after\npulsar-admin namespaces set-schema-compatibility-strategy public/default --compatibility BACKWARD_TRANSITIVE","handlingStrategy":"validation","validationCode":"S=$(echo \"${COMPAT:-}\" | tr 'a-z' 'A-Z' | tr -d '-')\nVALID=\"ALWAYS_COMPATIBLE BACKWARD BACKWARD_TRANSITIVE FORWARD FORWARD_TRANSITIVE FULL FULL_TRANSITIVE NONE\"\n[[ \" $VALID \" == *\" $S \"* ]] || { echo \"invalid strategy: $S\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use exact SchemaCompatibilityStrategy enum names, uppercase with underscores.","Strip hyphens/whitespace from user input before passing the flag.","Check --help on your Pulsar version; enum values changed across releases."],"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-14T05:17:10.506Z"}