{"record":{"id":"c6e8f13d5c7847f1","repo":"apache/rocketmq","slug":"maxsizeinbytes-0","errorCode":null,"errorMessage":"maxSizeInBytes <= 0","messagePattern":"maxSizeInBytes <= 0","errorType":"exception","errorClass":"MQClientException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java","lineNumber":518,"sourceCode":"        final PullCallback pullCallback,\n        final boolean block,\n        final long timeout) throws MQClientException, RemotingException, InterruptedException {\n        this.isRunning();\n\n        if (null == mq) {\n            throw new MQClientException(\"mq is null\", null);\n        }\n\n        if (offset < 0) {\n            throw new MQClientException(\"offset < 0\", null);\n        }\n\n        if (maxNums <= 0) {\n            throw new MQClientException(\"maxNums <= 0\", null);\n        }\n\n        if (maxSizeInBytes <= 0) {\n            throw new MQClientException(\"maxSizeInBytes <= 0\", null);\n        }\n\n\n        if (null == pullCallback) {\n            throw new MQClientException(\"pullCallback is null\", null);\n        }\n\n        this.subscriptionAutomatically(mq.getTopic());\n\n        try {\n            int sysFlag = PullSysFlag.buildSysFlag(false, block, true, false);\n\n            long timeoutMillis = block ? this.defaultMQPullConsumer.getConsumerTimeoutMillisWhenSuspend() : timeout;\n\n            boolean isTagType = ExpressionType.isTagType(subscriptionData.getExpressionType());\n            this.pullAPIWrapper.pullKernelImpl(\n                mq,\n                subscriptionData.getSubString(),","sourceCodeStart":500,"sourceCodeEnd":536,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java#L500-L536","documentation":"Thrown by pullAsyncImpl when maxSizeInBytes (max cumulative message body size for one pull request) is zero or negative. This overload-level byte cap protects the client from oversized pull payloads and is validated before the request is issued.","triggerScenarios":"Calling the pullAsync overload that takes maxSizeInBytes with a value <= 0; deriving the cap from a config property that defaults to 0; computing bytes-per-message * maxNums where either factor is zero.","commonSituations":"Applications setting consumer.setPullThresholdSizePerQueue(...) or a custom byte cap incorrectly; new async integrations copying the 8-arg overload without setting the size parameter.","solutions":["Pass a positive byte cap, e.g. 10 * 1024 * 1024 (10 MiB) or DefaultMQPushConsumer's default pullThresholdSizePerQueue","Validate the config value at startup and fail fast if <= 0","Prefer the simpler pullAsync overloads unless byte capping is genuinely required"],"exampleFix":"// before\nconsumer.pullAsync(mq, \"*\", off, 32, 0, cb, false, 3000);\n\n// after\nint maxBytes = 10 * 1024 * 1024;\nconsumer.pullAsync(mq, \"*\", off, 32, maxBytes, cb, false, 3000);","handlingStrategy":"validation","validationCode":"int maxBytes = configuredMaxBytes > 0 ? configuredMaxBytes : 10 * 1024 * 1024;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer simpler pullAsync overloads unless byte caps are required","Validate byte-cap config at startup"],"tags":["rocketmq","pull-consumer","size-limit","async-pull","argument-validation"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}