{"record":{"id":"b3cce74c9d7750b3","repo":"apache/rocketmq","slug":"consumetimestamp-is-invalid-the-valid-format-is-y","errorCode":null,"errorMessage":"consumeTimestamp is invalid, the valid format is yyyyMMddHHmmss,but received {consumeTimestamp}","messagePattern":"consumeTimestamp is invalid, the valid format is yyyyMMddHHmmss,but received (.+?)","errorType":"validation","errorClass":"MQClientException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java","lineNumber":1060,"sourceCode":"        }\n\n        if (null == this.defaultMQPushConsumer.getMessageModel()) {\n            throw new MQClientException(\n                \"messageModel is null\"\n                    + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),\n                null);\n        }\n\n        if (null == this.defaultMQPushConsumer.getConsumeFromWhere()) {\n            throw new MQClientException(\n                \"consumeFromWhere is null\"\n                    + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),\n                null);\n        }\n\n        Date dt = UtilAll.parseDate(this.defaultMQPushConsumer.getConsumeTimestamp(), UtilAll.YYYYMMDDHHMMSS);\n        if (null == dt) {\n            throw new MQClientException(\n                \"consumeTimestamp is invalid, the valid format is yyyyMMddHHmmss,but received \"\n                    + this.defaultMQPushConsumer.getConsumeTimestamp()\n                    + \" \" + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL), null);\n        }\n\n        // allocateMessageQueueStrategy\n        if (null == this.defaultMQPushConsumer.getAllocateMessageQueueStrategy()) {\n            throw new MQClientException(\n                \"allocateMessageQueueStrategy is null\"\n                    + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),\n                null);\n        }\n\n        // subscription\n        if (null == this.defaultMQPushConsumer.getSubscription()) {\n            throw new MQClientException(\n                \"subscription is null\"\n                    + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),","sourceCodeStart":1042,"sourceCodeEnd":1078,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java#L1042-L1078","documentation":"checkConfig() parses consumeTimestamp with UtilAll.parseDate(value, \"yyyyMMddHHmmss\") and throws when parsing yields null. The timestamp only matters for CONSUME_FROM_TIMESTAMP mode, but it is validated on every start(). DefaultMQPushConsumer ships a valid default, so failure means a user-supplied string in the wrong format.","triggerScenarios":"Calling setConsumeTimestamp(\"2024-01-01 00:00:00\") or any non-numeric format; passing a millisecond-epoch string; trailing/leading whitespace or an empty string after explicit set.","commonSituations":"Copying an ISO-8601 timestamp from logs into config; feeding an epoch-millis value; i18n date formats from config files.","solutions":["Use exactly 14 digits yyyyMMddHHmmss, e.g. 20240101000000","If you want 'now', simply leave the default (a sentinel meaning current time) rather than formatting Date yourself","Validate the format in config loading (regex ^\\d{14}$) so bad values fail before start()"],"exampleFix":"// before\nconsumer.setConsumeTimestamp(\"2024-01-01 00:00:00\");\n\n// after\nconsumer.setConsumeTimestamp(\"20240101000000\");","handlingStrategy":"validation","validationCode":"if (consumeTimestamp != null && !consumeTimestamp.matches(\"^\\\\d{14}$\"))\n    throw new IllegalArgumentException(\"consumeTimestamp must be yyyyMMddHHmmss: \" + consumeTimestamp);\nconsumer.setConsumeTimestamp(consumeTimestamp);","typeGuard":"boolean isValidConsumeTimestamp(String s) { return s == null || s.matches(\"^\\\\d{14}$\"); }","tryCatchPattern":null,"preventionTips":["Format timestamps with DateTimeFormatter.ofPattern(\"yyyyMMddHHmmss\") at the source","Leave the default when 'consume from now' is intended","Add a config-format test for any timestamp values you inject"],"tags":["rocketmq","config","timestamp","format"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}