{"record":{"id":"d6a2a953ff35512c","repo":"apache/pulsar","slug":"quota-type-of-message-age-needs-a-time-limit-d6a2a9","errorCode":null,"errorMessage":"Quota type of 'message_age' needs a time limit","messagePattern":"Quota type of 'message_age' needs a time limit","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopicPolicies.java","lineNumber":1076,"sourceCode":"            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\n        @Parameters(description = \"persistent://tenant/namespace/topic\", arity = \"1\")\n        private String topicName;\n\n        @Option(names = {\"-t\", \"--type\"}, description = \"Backlog quota type to remove\")\n        private String backlogQuotaType = BacklogQuota.BacklogQuotaType.destination_storage.name();\n","sourceCodeStart":1058,"sourceCodeEnd":1094,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopicPolicies.java#L1058-L1094","documentation":"Backlog-quota option validation in CmdTopicPolicies: the backlog quota type was set to message_age but no time limit (--limit-time) accompanies it, and a message-age quota is meaningless without a duration threshold; the missing time-limit option is the faulty input.","triggerScenarios":"Running set-backlog-quota with --quota-type message_age but supplying only --limit (a size) and no --limitTime value.","commonSituations":"Users copying size-based quota examples and switching the type to message_age without swapping --limit for --limitTime; scripts where the limitTime variable defaults to null/empty; confusion between the size --limit flag and the time --limitTime flag.","solutions":["Set --limitTime (time limit) when using --limit for message_age quota"],"exampleFix":"// before\npulsar-admin topics set-backlog-quota my-topic --quota-type message_age --limit 10G\n// after\npulsar-admin topics set-backlog-quota my-topic --quota-type message_age --limitTime 86400","handlingStrategy":"validation","validationCode":"if (\"message_age\".equals(quotaType) && (limitTimeInSec == null)) {\n    throw new IllegalArgumentException(\"--limitTime (seconds) is required when quota-type is message_age\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair message_age with --limitTime in seconds","Do not reuse size-based quota command templates for time-based quotas","Check the emitted command line in CI logs for null flag values"],"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"}