{"record":{"id":"f8021ed4104def14","repo":"apache/pulsar","slug":"invalid-backlog-quota-type-s-valid-options-are-f8021e","errorCode":null,"errorMessage":"Invalid backlog quota type '%s'. Valid options are: %s","messagePattern":"Invalid backlog quota type '(.+?)'\\. Valid options are: (.+?)","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"warning","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java","lineNumber":1542,"sourceCode":"                + \"You can set size or time to control the backlog, or combine them together to control the backlog. \")\n        private String backlogQuotaTypeStr = BacklogQuota.BacklogQuotaType.destination_storage.name();\n\n        @Override\n        void run() throws PulsarAdminException {\n            BacklogQuota.RetentionPolicy policy;\n            BacklogQuota.BacklogQuotaType backlogQuotaType;\n\n            try {\n                policy = BacklogQuota.RetentionPolicy.valueOf(policyStr);\n            } catch (IllegalArgumentException e) {\n                throw new ParameterException(String.format(\"Invalid retention policy type '%s'. Valid options are: %s\",\n                        policyStr, Arrays.toString(BacklogQuota.RetentionPolicy.values())));\n            }\n\n            try {\n                backlogQuotaType = BacklogQuota.BacklogQuotaType.valueOf(backlogQuotaTypeStr);\n            } catch (IllegalArgumentException e) {\n                throw new ParameterException(String.format(\"Invalid backlog quota type '%s'. Valid options are: %s\",\n                        backlogQuotaTypeStr, Arrays.toString(BacklogQuota.BacklogQuotaType.values())));\n            }\n\n            String persistentTopic = validatePersistentTopic(topicName);\n            getTopics().setBacklogQuota(persistentTopic,\n                    BacklogQuota.builder().limitSize(limit)\n                            .limitTime(limitTimeInSec.intValue())\n                            .retentionPolicy(policy)\n                            .build(),\n                    backlogQuotaType);\n        }\n    }\n\n    @Command(description = \"Remove a backlog quota policy from a topic\", hidden = true)\n    private class RemoveBacklogQuota extends CliCommand {\n\n        @Parameters(description = \"persistent://tenant/namespace/topic\", arity = \"1\")\n        private String topicName;","sourceCodeStart":1524,"sourceCodeEnd":1560,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java#L1524-L1560","documentation":"When setting a topic backlog quota, the --type value must be a valid BacklogQuota.BacklogQuotaType enum name. An unrecognized string throws IllegalArgumentException, converted to ParameterException listing valid options.","triggerScenarios":"Running `pulsar-admin topics set-backlog-quota <topic> --type <bad-value> ...` where backlogQuotaTypeStr is not exactly message_age or target_storage (the BacklogQuotaType values).","commonSituations":"Typos or wrong casing; using 'time'/'size' informally instead of the enum names; confusion between policy and type flags; scripts written against different Pulsar versions.","solutions":["Use an exact valid type name: message_age or target_storage","Check the valid options listed in the error message","Ensure --type is not confused with --policy (which takes RetentionPolicy values)"],"exampleFix":"// before\npulsar-admin topics set-backlog-quota my-topic --type size --limit 100000000\n// after\npulsar-admin topics set-backlog-quota my-topic --type target_storage --limit 100000000","handlingStrategy":"validation","validationCode":"Set<String> valid = Set.of(\"message_age\", \"target_storage\");\nif (!valid.contains(typeStr)) {\n    throw new IllegalArgumentException(\"type must be one of \" + valid);\n}","typeGuard":null,"tryCatchPattern":"try {\n    BacklogQuota.BacklogQuotaType.valueOf(typeStr);\n} catch (IllegalArgumentException e) {\n    log.error(\"Invalid backlog quota type '{}'; valid: {}\", typeStr,\n        Arrays.toString(BacklogQuota.BacklogQuotaType.values()));\n}","preventionTips":["Use exact enum names: message_age or target_storage","Don't confuse --type with --policy (different enums)","Remember valueOf is case-sensitive"],"tags":["cli","parameter-validation","backlog-quota","enum"],"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"}