t8y2/dbx · error

no RocketMQ master brokers available to %s %s

Error message

no RocketMQ master brokers available to %s %s

What it means

ensureMutationCoverage guards broker-side mutations (delete/update subscription group). Mutations must be attempted on every master broker; if attempted is 0, no master brokers were resolved, so nothing was changed anywhere and the library reports "no RocketMQ master brokers available to <action> <resource>". This is a topology discovery failure, not a write failure.

Source

Thrown at agents/drivers/rocketmq/consumers.go:636

		return nil, fmt.Errorf("decode subscription groups: %w", err)
	}
	return wrapper.SubscriptionGroupTable, nil
}

func writeSubscriptionGroupConfig(ctx context.Context, address string, config *subscriptionGroupConfig) error {
	body, err := json.Marshal(config)
	if err != nil {
		return fmt.Errorf("encode subscription group config: %w", err)
	}
	command := remoting.NewRequest(remoting.UpdateAndCreateSubscriptionGroup, nil)
	command.Body = body
	_, err = invokeRemotingWithClient(ctx, address, command)
	return err
}

func ensureMutationCoverage(action, resource string, attempted, succeeded int, lastErr error) error {
	if attempted <= 0 {
		return fmt.Errorf("no RocketMQ master brokers available to %s %s", action, resource)
	}
	if succeeded == attempted {
		return nil
	}
	message := fmt.Sprintf("failed to %s %s on all masters: %d of %d succeeded", action, resource, succeeded, attempted)
	if lastErr != nil {
		return fmt.Errorf("%s: %w", message, lastErr)
	}
	return fmt.Errorf("%s", message)
}

func (a *rocketMQAgent) enrichConsumerGroups(ctx context.Context, client *admin.Client, rows []map[string]any) {
	for _, row := range rows {
		groupID := fmt.Sprint(row["groupId"])
		connection, err := client.ExamineConsumerConnectionInfo(ctx, groupID)
		if err != nil {
			if _, ok := row["topics"]; !ok {
				row["topics"] = []string{}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Verify the name server is reachable and returns routes for the cluster (broker list is non-empty)
  2. Confirm the cluster has master brokers (brokerId == 0), not only replicas
  3. Check the broker address list/selection logic for filters that exclude all brokers
  4. Wait for brokers to finish starting or fix crashed masters before mutating
  5. Fall back to explicitly passing master broker addresses if discovery is unreliable

Example fix

// before
addrs := brokerAddresses(cluster) // may be empty
return alterSubscriptionGroupConfig(ctx, addrs, cfg)
// after
addrs := brokerAddresses(cluster)
if len(addrs) == 0 {
    return fmt.Errorf("cannot alter subscription group %s: no master brokers discovered; check nameserver and broker roles", cfg.GroupName)
}
return alterSubscriptionGroupConfig(ctx, addrs, cfg)
Defensive patterns

Strategy: validation

Validate before calling

masters := discoverMasterBrokers(ctx, namesrv)
if len(masters) == 0 {
    return fmt.Errorf("aborting %s of %s: no master brokers found; check nameserver and broker roles", action, resource)
}

Type guard

func hasMasterBrokers(addrs []string) bool { return len(addrs) > 0 }

Try / catch

err := deleteConsumerGroup(ctx, client, group)
if err != nil && strings.Contains(err.Error(), "no RocketMQ master brokers available") {
    log.Printf("cluster topology empty — verify nameserver %s and broker roles before retrying", namesrv)
    return err
}

Prevention

When it happens

Trigger: deleteConsumerGroup or alterSubscriptionGroupConfig invoked when the cluster has zero reachable/eligible master brokers — e.g. the name server returned no route, all brokers are replicas (no masters), or the address list was empty after filtering.

Common situations: Single-replica-cluster configured with only slave nodes; name server unreachable or route cache empty; brokers still booting; broker IPs filtered out by health checks or the provided address list is wrong.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/f4a2062612474629. Report an issue: GitHub.