apache/rocketmq · error · MQClientException

producerGroup can not equal {defaultProducerGroup}, please s

Error message

producerGroup can not equal {defaultProducerGroup}, please specify another one.

What it means

MQClientException thrown by DefaultMQProducerImpl.checkConfig() during start() when the configured producerGroup equals the literal default "DEFAULT_PRODUCER" (MixAll.DEFAULT_PRODUCER_GROUP). RocketMQ forbids the sentinel value to force operators to pick a meaningful, unique group, since group names are used for metrics, alerting, and (for consumers) failover identity. Validators.checkGroup has already run, so an empty/invalid group fails earlier with a different message.

Source

Thrown at client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:299

                throw new MQClientException("The producer service state not OK, maybe started once, "
                    + this.serviceState
                    + FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK),
                    null);
            default:
                break;
        }

        this.mQClientFactory.sendHeartbeatToAllBrokerWithLock();

        RequestFutureHolder.getInstance().startScheduledTask(this);

    }

    private void checkConfig() throws MQClientException {
        Validators.checkGroup(this.defaultMQProducer.getProducerGroup());

        if (this.defaultMQProducer.getProducerGroup().equals(MixAll.DEFAULT_PRODUCER_GROUP)) {
            throw new MQClientException("producerGroup can not equal " + MixAll.DEFAULT_PRODUCER_GROUP + ", please specify another one.",
                null);
        }
    }

    public void shutdown() {
        this.shutdown(true);
    }

    public void shutdown(final boolean shutdownFactory) {
        switch (this.serviceState) {
            case CREATE_JUST:
                break;
            case RUNNING:
                this.mQClientFactory.unregisterProducer(this.defaultMQProducer.getProducerGroup());
                this.defaultAsyncSenderExecutor.shutdown();
                if (shutdownFactory) {
                    this.mQClientFactory.shutdown();
                }

View on GitHub (pinned to 293f588571)

Solutions

  1. Set a unique, application-specific group: new DefaultMQProducer("my-app-order-producer") or setProducerGroup(...) before start()
  2. If config is externalized, verify the resolved value at startup (log producer.getProducerGroup()) and fail fast in your own code if it is DEFAULT_PRODUCER
  3. Follow naming conventions like <app>-<domain>-producer to avoid collisions across teams

Example fix

// before
DefaultMQProducer producer = new DefaultMQProducer();
producer.start(); // throws
// after
DefaultMQProducer producer = new DefaultMQProducer("checkout-service-producer");
producer.setNamesrvAddr(namesrv);
producer.start();
Defensive patterns

Strategy: validation

Validate before calling

 String group = props.getProperty("producer.group", "DEFAULT_PRODUCER");
if ("DEFAULT_PRODUCER".equals(group) || group.isBlank()) {
    throw new ConfigurationException("producer.group must be set to a unique non-default value");
}
DefaultMQProducer p = new DefaultMQProducer(group);

Prevention

When it happens

Trigger: new DefaultMQProducer() with the no-arg constructor followed by start(); explicitly setProducerGroup("DEFAULT_PRODUCER") or setProducerGroup("") after construction then start(); copying quickstart code that never sets a group.

Common situations: commonSituations

Related errors


AI-assisted analysis of apache/rocketmq@293f588571 (2026-08-14). Data as JSON: /api/errors/4626812a92cddc79. Report an issue: GitHub.