{"record":{"id":"df67f4a3f2da748a","repo":"alibaba/spring-cloud-alibaba","slug":"defaultmqpushconsumer-not-initialized","errorCode":null,"errorMessage":"DefaultMQPushConsumer not initialized","messagePattern":"DefaultMQPushConsumer not initialized","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/integration/inbound/RocketMQInboundChannelAdapter.java","lineNumber":191,"sourceCode":"\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tlog.warn(\"consume message failed. messageExt:{}\", messageExt, e);\n\t\t\t\treturn failSupplier.get();\n\t\t\t}\n\t\t}\n\t\treturn sucSupplier.get();\n\t}\n\n\t@Override\n\tprotected void doStart() {\n\t\tif (extendedConsumerProperties.getExtension() == null\n\t\t\t\t|| !extendedConsumerProperties.getExtension().getEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tInstrumentation instrumentation = new Instrumentation(topic, this);\n\t\ttry {\n\t\t\tif (pushConsumer == null) {\n\t\t\t\tthrow new IllegalStateException(\"DefaultMQPushConsumer not initialized\");\n\t\t\t}\n\t\t\tString subscription = extendedConsumerProperties.getExtension()\n\t\t\t\t\t.getSubscription();\n\t\t\tpushConsumer.subscribe(topic, RocketMQUtils.getMessageSelector(\n\t\t\t\t\tsubscription != null ? subscription : \"\"));\n\t\t\tpushConsumer.start();\n\t\t\tinstrumentation.markStartedSuccessfully();\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tinstrumentation.markStartFailed(e);\n\t\t\tlog.error(\"DefaultMQPushConsumer init failed, Caused by \" + e.getMessage());\n\t\t\tthrow new MessagingException(MessageBuilder.withPayload(\n\t\t\t\t\t\"DefaultMQPushConsumer init failed, Caused by \" + e.getMessage())\n\t\t\t\t\t.build(), e);\n\t\t}\n\t\tfinally {\n\t\t\tInstrumentationManager.addHealthInstrumentation(instrumentation);\n\t\t}","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/alibaba/spring-cloud-alibaba/blob/115d5901102009492e05d5ec18c3f79cad4077d0/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/integration/inbound/RocketMQInboundChannelAdapter.java#L173-L209","documentation":"doStart throws IllegalStateException when pushConsumer is null - the adapter was never initialized (constructor failed or never ran), yet lifecycle start() was invoked. It is an internal-state assertion: you cannot start a consumer that was not built.","triggerScenarios":"doStart() executes while the pushConsumer field is still null - e.g. constructor initialization was skipped/failed, or the extension is enabled but construction threw and left the field null.","commonSituations":"A previous init exception was swallowed; the binding's `enabled` flipped after partial init; bean lifecycle/aspect interfering with the constructor; manual instantiation of the adapter without calling its initializer.","solutions":["Check the logs for an earlier [123] init failure that left pushConsumer null and fix that root cause.","Ensure the binding extension `enabled=true` and the constructor path completes.","Avoid manually constructing/starting the adapter; let Spring manage its lifecycle."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Assert readiness before start.\nif (adapter.getPushConsumer() == null) {\n    throw new IllegalStateException(\"Cannot start: pushConsumer was never initialized; resolve the prior init failure.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never ignore earlier consumer init failures - they leave the adapter half-built.","Let Spring Cloud Stream own the adapter lifecycle.","Verify `enabled=true` for bindings you expect to consume from."],"tags":["rocketmq","consumer","lifecycle","startup"],"backgroundTag":null,"analyzedSha":"115d5901102009492e05d5ec18c3f79cad4077d0","analyzedAt":"2026-08-14T04:47:13.900Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}