apache/kafka · error · IllegalArgumentException

Specified assignors {} do not have commonly supported rebala

Error message

Specified assignors {} do not have commonly supported rebalance protocol

What it means

IllegalArgumentException thrown in the ConsumerCoordinator constructor (ConsumerCoordinator.java:264) when the configured partition assignors share no common rebalance protocol. Each ConsumerPartitionAssignor declares supportedProtocols() (EAGER or COOPERATIVE); the constructor intersects them. Mixing an eager-only assignor (RangeAssignor, RoundRobinAssignor, StickyAssignor) with a cooperative-only one (CooperativeStickyAssignor) yields an empty intersection and fails fast at consumer creation.

Source

Thrown at clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java:264

        if (autoCommitEnabled)
            this.nextAutoCommitTimer = time.timer(autoCommitIntervalMs);

        // select the rebalance protocol such that:
        //   1. only consider protocols that are supported by all the assignors. If there is no common protocols supported
        //      across all the assignors, throw an exception.
        //   2. if there are multiple protocols that are commonly supported, select the one with the highest id (i.e. the
        //      id number indicates how advanced the protocol is).
        // we know there are at least one assignor in the list, no need to double check for NPE
        if (!assignors.isEmpty()) {
            List<RebalanceProtocol> supportedProtocols = new ArrayList<>(assignors.get(0).supportedProtocols());

            for (ConsumerPartitionAssignor assignor : assignors) {
                supportedProtocols.retainAll(assignor.supportedProtocols());
            }

            if (supportedProtocols.isEmpty()) {
                throw new IllegalArgumentException("Specified assignors " +
                    assignors.stream().map(ConsumerPartitionAssignor::name).collect(Collectors.toSet()) +
                    " do not have commonly supported rebalance protocol");
            }

            Collections.sort(supportedProtocols);

            protocol = supportedProtocols.get(supportedProtocols.size() - 1);
        } else {
            protocol = null;
        }

        this.rebalanceCallbackMetricsManager = new RebalanceCallbackMetricsManager(metrics, metricGrpPrefix);
        this.rebalanceListenerInvoker = new ConsumerRebalanceListenerInvoker(
            logContext,
            subscriptions,
            time,
            rebalanceCallbackMetricsManager
        );

View on GitHub (pinned to c31c9215e1)

Solutions

  1. Use assignors from a single protocol family — either all eager (RangeAssignor, RoundRobinAssignor, StickyAssignor) or all cooperative (CooperativeStickyAssignor).
  2. When migrating eager to cooperative per KIP-429, do it in two rolling steps: first add the cooperative assignor to the end of the list on every member, then in a second rollout remove the eager entries.
  3. Remove the conflicting assignor from partition.assignment.strategy entirely.

Example fix

// before — mixes eager + cooperative, no common protocol
props.put(ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG,
    RangeAssignor.class.getName() + "," +
    CooperativeStickyAssignor.class.getName());
new KafkaConsumer<String,String>(props);   // throws IllegalArgumentException

// after — pick one family
props.put(ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG,
    CooperativeStickyAssignor.class.getName());
Defensive patterns

Strategy: validation

Validate before calling

// Before building the consumer, verify configured assignors share a protocol
List<ConsumerPartitionAssignor> as = Arrays.asList(
    new org.apache.kafka.clients.consumer.CooperativeStickyAssignor());
Set<RebalanceProtocol> common = new HashSet<>(as.get(0).supportedProtocols());
for (ConsumerPartitionAssignor a : as) common.retainAll(a.supportedProtocols());
if (common.isEmpty())
    throw new IllegalArgumentException("assignors share no common rebalance protocol");

Try / catch

try {
    consumer = new KafkaConsumer<>(props);
} catch (IllegalArgumentException e) {
    // assignors were incompatible (e.g. mixed eager + cooperative); pick one family
    props.put(ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG,
              CooperativeStickyAssignor.class.getName());
    consumer = new KafkaConsumer<>(props);
}

Prevention

When it happens

Trigger: Constructing a KafkaConsumer whose partition.assignment.strategy lists assignors from incompatible protocol families — e.g. RangeAssignor + CooperativeStickyAssignor. The intersection loop at ConsumerCoordinator.java:259-261 reduces supportedProtocols to empty.

Common situations: Migrating from eager to cooperative rebalancing and accidentally listing both styles; copy-pasting config snippets that mix strategies; older pre-2.4 examples combined with newer assignors; rolling out a custom assignor that declares a different protocol than the existing ones.

Related errors


AI-assisted analysis of apache/kafka@c31c9215e1 (2026-08-03). Data as JSON: /data/errors/9ba469246c855392.json. Report an issue: GitHub.