{"record":{"id":"0f0e600503cdc1cc","repo":"apache/rocketmq","slug":"consumethreadmax-out-of-range-1-1000","errorCode":null,"errorMessage":"consumeThreadMax Out of range [1, 1000]","messagePattern":"consumeThreadMax Out of range \\[1, 1000\\]","errorType":"validation","errorClass":"MQClientException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java","lineNumber":1110,"sourceCode":"        if (!orderly && !concurrently) {\n            throw new MQClientException(\n                \"messageListener must be instanceof MessageListenerOrderly or MessageListenerConcurrently\"\n                    + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),\n                null);\n        }\n\n        // consumeThreadMin\n        if (this.defaultMQPushConsumer.getConsumeThreadMin() < 1\n            || this.defaultMQPushConsumer.getConsumeThreadMin() > 1000) {\n            throw new MQClientException(\n                \"consumeThreadMin Out of range [1, 1000]\"\n                    + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),\n                null);\n        }\n\n        // consumeThreadMax\n        if (this.defaultMQPushConsumer.getConsumeThreadMax() < 1 || this.defaultMQPushConsumer.getConsumeThreadMax() > 1000) {\n            throw new MQClientException(\n                \"consumeThreadMax Out of range [1, 1000]\"\n                    + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),\n                null);\n        }\n\n        // consumeThreadMin can't be larger than consumeThreadMax\n        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]\"","sourceCodeStart":1092,"sourceCodeEnd":1128,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java#L1092-L1128","documentation":"checkConfig() validates the consume-thread pool's maximum thread count: it must be between 1 and 1000 inclusive. Default is 20 (or 65 in some versions), so this is always an explicitly misconfigured value.","triggerScenarios":"setConsumeThreadMax(0), a negative number, or >1000; copying a large 'maxThreads' value from an HTTP server pool config; unit mismatch (e.g. 5000 meant as a queue capacity).","commonSituations":"Porting Tomcat/Netty pool settings into RocketMQ consumer config; scaling thread counts for slow consumers and overshooting the hard cap.","solutions":["Set consumeThreadMax within [1,1000]; size for your consumer latency (e.g. 20-200)","If throughput is insufficient at 1000 threads, the bottleneck is usually the consumer logic or downstream — parallelize there instead","Keep min <= max to avoid error 236"],"exampleFix":"// before\nconsumer.setConsumeThreadMax(2000); // over cap\n\n// after\nconsumer.setConsumeThreadMax(200);","handlingStrategy":"validation","validationCode":"int max = config.getConsumeThreadMax();\nif (max < 1 || max > 1000) throw new IllegalArgumentException(\"consumeThreadMax must be in [1,1000]: \" + max);\nconsumer.setConsumeThreadMax(max);","typeGuard":"boolean inThreadRange(int v) { return v >= 1 && v <= 1000; }","tryCatchPattern":null,"preventionTips":["Do not port HTTP-server pool sizes into consumer thread settings","Range-check consumeThreadMin and consumeThreadMax together before start"],"tags":["rocketmq","config","thread-pool","validation"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}