conductor-oss/conductor · error · IllegalArgumentException

Batch size must be greater than 0

Error message

Batch size must be greater than 0

What it means

Constructor guard on AMQPObservableQueue: batchSize <= 0. batchSize controls basicQos(prefetch) and how many messages are drained per poll cycle, so a non-positive value is rejected. The Builder reads it from AMQPEventQueueProperties.getBatchSize().

Source

Thrown at amqp/src/main/java/com/netflix/conductor/contribs/queue/amqp/AMQPObservableQueue.java:89

    public AMQPObservableQueue(
            ConnectionFactory factory,
            Address[] addresses,
            boolean useExchange,
            AMQPSettings settings,
            AMQPRetryPattern retrySettings,
            int batchSize,
            int pollTimeInMS) {
        if (factory == null) {
            throw new IllegalArgumentException("Connection factory is undefined");
        }
        if (addresses == null || addresses.length == 0) {
            throw new IllegalArgumentException("Addresses are undefined");
        }
        if (settings == null) {
            throw new IllegalArgumentException("Settings are undefined");
        }
        if (batchSize <= 0) {
            throw new IllegalArgumentException("Batch size must be greater than 0");
        }
        if (pollTimeInMS <= 0) {
            throw new IllegalArgumentException("Poll time must be greater than 0 ms");
        }
        this.useExchange = useExchange;
        this.settings = settings;
        this.batchSize = batchSize;
        this.amqpConnection = AMQPConnection.getInstance(factory, addresses, retrySettings);
        this.retrySettings = retrySettings;
        this.setPollTimeInMS(pollTimeInMS);
    }

    @Override
    public Observable<Message> observe() {
        Observable.OnSubscribe<Message> onSubscribe = null;
        // This will enabled the messages to be processed one after the other as per the
        // observable next behavior.
        if (settings.isSequentialProcessing()) {

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Set a positive batchSize in AMQPEventQueueProperties (e.g. 1 or higher).
  2. If constructing directly, pass an explicit positive batchSize.
  3. Validate the property at application startup.

Example fix

# before: unset batch size defaults to 0 -> constructor rejects
# (no property set)

# after: set a positive batch size
conductor.amqp.batchSize=10
Defensive patterns

Strategy: validation

Validate before calling

if (batchSize <= 0) {
    throw new IllegalArgumentException("batchSize must be positive; check conductor.amqp.batchSize");
}

Prevention

When it happens

Trigger: Constructing the queue with batchSize of 0 or negative; the Builder used because properties.getBatchSize() returned a non-positive value (unset property defaulting to 0).

Common situations: The batchSize property (e.g. conductor AMQP batch size) is unset or misconfigured to 0; a profile override cleared it.

Related errors


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/8edc928f9f3b8417. Report an issue: GitHub.