{"record":{"id":"61a54a33cd49c349","repo":"apache/rocketmq","slug":"pullthresholdforqueue-out-of-range-1-65535","errorCode":null,"errorMessage":"pullThresholdForQueue Out of range [1, 65535]","messagePattern":"pullThresholdForQueue Out of range \\[1, 65535\\]","errorType":"validation","errorClass":"MQClientException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java","lineNumber":1135,"sourceCode":"        if (this.defaultMQPushConsumer.getConsumeThreadMin() > this.defaultMQPushConsumer.getConsumeThreadMax()) {\n            throw new MQClientException(\n                \"consumeThreadMin (\" + this.defaultMQPushConsumer.getConsumeThreadMin() + \") \"\n                    + \"is larger than consumeThreadMax (\" + this.defaultMQPushConsumer.getConsumeThreadMax() + \")\",\n                null);\n        }\n\n        // consumeConcurrentlyMaxSpan\n        if (this.defaultMQPushConsumer.getConsumeConcurrentlyMaxSpan() < 1\n            || this.defaultMQPushConsumer.getConsumeConcurrentlyMaxSpan() > 65535) {\n            throw new MQClientException(\n                \"consumeConcurrentlyMaxSpan Out of range [1, 65535]\"\n                    + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),\n                null);\n        }\n\n        // pullThresholdForQueue\n        if (this.defaultMQPushConsumer.getPullThresholdForQueue() < 1 || this.defaultMQPushConsumer.getPullThresholdForQueue() > 65535) {\n            throw new MQClientException(\n                \"pullThresholdForQueue Out of range [1, 65535]\"\n                    + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),\n                null);\n        }\n\n        // pullThresholdForTopic\n        if (this.defaultMQPushConsumer.getPullThresholdForTopic() != -1) {\n            if (this.defaultMQPushConsumer.getPullThresholdForTopic() < 1 || this.defaultMQPushConsumer.getPullThresholdForTopic() > 6553500) {\n                throw new MQClientException(\n                    \"pullThresholdForTopic Out of range [1, 6553500]\"\n                        + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),\n                    null);\n            }\n        }\n\n        // pullThresholdSizeForQueue\n        if (this.defaultMQPushConsumer.getPullThresholdSizeForQueue() < 1 || this.defaultMQPushConsumer.getPullThresholdSizeForQueue() > 1024) {\n            throw new MQClientException(","sourceCodeStart":1117,"sourceCodeEnd":1153,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java#L1117-L1153","documentation":"checkConfig() validates pullThresholdForQueue — the per-queue limit of locally cached (not yet consumed) messages that triggers pull flow control — which must be in [1, 65535]. Default is 1000, so the error implies an explicit out-of-range value.","triggerScenarios":"setPullThresholdForQueue(0) (intending 'no limit'), a negative value, or >65535; unit confusion with pullThresholdSizeForQueue (which is in MiB and capped at 1024).","commonSituations":"Attempting to disable message-count flow control for fast consumers; copying memory-based thresholds (e.g. 100000) into the count-based field.","solutions":["Keep pullThresholdForQueue in [1,65535]; default 1000, raise to e.g. 5000 if pull flow control logs appear","To disable per-queue count flow control in newer versions, use pullThresholdForTopic=-1 semantics carefully instead of 0 on the queue field","Check the sibling field: pullThresholdSizeForQueue (MiB, [1,1024]) is a separate knob often confused with this one"],"exampleFix":"// before\nconsumer.setPullThresholdForQueue(0); // meant 'unlimited'\n\n// after\nconsumer.setPullThresholdForQueue(1000); // default; raise within [1,65535] as needed","handlingStrategy":"validation","validationCode":"int t = config.getPullThresholdForQueue();\nif (t < 1 || t > 65535) throw new IllegalArgumentException(\"pullThresholdForQueue must be in [1,65535]: \" + t);\nconsumer.setPullThresholdForQueue(t);","typeGuard":"boolean inQueueThresholdRange(int v) { return v >= 1 && v <= 65535; }","tryCatchPattern":null,"preventionTips":["Keep count-based (pullThresholdForQueue, [1,65535]) and size-based (pullThresholdSizeForQueue, [1,1024] MiB) settings clearly named in config","Raise thresholds moderately instead of trying to disable flow control"],"tags":["rocketmq","config","flow-control","validation"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}