{"record":{"id":"934437e58dcad059","repo":"apache/pulsar","slug":"quota-type-of-destination-storage-needs-a-size-l-934437","errorCode":null,"errorMessage":"Quota type of 'destination_storage' needs a size limit","messagePattern":"Quota type of 'destination_storage' needs a size limit","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopicPolicies.java","lineNumber":1070,"sourceCode":"            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            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            String persistentTopic = validatePersistentTopic(topicName);\n            BacklogQuota.Builder builder = BacklogQuota.builder().retentionPolicy(policy);\n\n            if (backlogQuotaType == BacklogQuota.BacklogQuotaType.destination_storage) {\n                // set quota by storage size\n                if (limit == null) {\n                    throw new ParameterException(\"Quota type of 'destination_storage' needs a size limit\");\n                }\n                builder.limitSize(limit);\n            } else {\n                // set quota by time\n                if (limitTimeInSec == null) {\n                    throw new ParameterException(\"Quota type of 'message_age' needs a time limit\");\n                }\n                builder.limitTime(limitTimeInSec.intValue());\n            }\n            getTopicPolicies(isGlobal).setBacklogQuota(persistentTopic,\n                    builder.build(),\n                    backlogQuotaType);\n        }\n    }\n\n    @Command(description = \"Remove a backlog quota policy from a topic\")\n    private class RemoveBacklogQuota extends CliCommand {\n","sourceCodeStart":1052,"sourceCodeEnd":1088,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopicPolicies.java#L1052-L1088","documentation":"When the backlog quota type is destination_storage, the quota must carry a byte-size limit; the CLI enforces that --limit is provided. If limit is null the command throws this ParameterException instead of sending an incomplete BacklogQuota to the broker.","triggerScenarios":"Running set-backlog-quota with --quota-type destination_storage (or the default type when no --quota-type is given, depending on code path) but omitting the --limit flag (e.g. only passing --limitTime).","commonSituations":"Scripts converted from message_age quotas where --limitTime is set instead of --limit; users assuming a broker default size applies when the flag is omitted; copying an example that uses time-based quotas.","solutions":["Add a size limit, e.g. --limit 10G, when using --quota-type destination_storage","If you intended a time-based quota, use --quota-type message_age together with --limitTime instead"],"exampleFix":"// before\npulsar-admin topics set-backlog-quota my-topic --quota-type destination_storage --limitTime 3600\n// after\npulsar-admin topics set-backlog-quota my-topic --quota-type destination_storage --limit 10G","handlingStrategy":"validation","validationCode":"if (\"destination_storage\".equals(quotaType) && (limit == null || limit.isEmpty())) {\n    throw new IllegalArgumentException(\"--limit (size) is required when quota-type is destination_storage\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair destination_storage with --limit","Pair message_age with --limitTime instead","Validate flag combinations in wrapper scripts before calling the CLI"],"tags":["cli","pulsar-admin","missing-argument","backlog-quota"],"backgroundTag":"missing-required-argument","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"}