conductor-oss/conductor · error · IllegalArgumentException
Delivery mode must be 1 or 2
Error message
Delivery mode must be 1 or 2
What it means
Thrown as IllegalArgumentException by setDeliveryMode when the value is neither 1 (non-persistent) nor 2 (persistent). AMQP 0-9-1 only defines these two delivery modes; any other integer is invalid. The constructor calls setDeliveryMode(properties.getDeliveryMode()), so a bad config value surfaces here.
Source
Thrown at amqp/src/main/java/com/netflix/conductor/contribs/queue/amqp/util/AMQPSettings.java:138
}
return exchangeBoundQueueName;
}
public String getExchangeType() {
return exchangeType;
}
public String getRoutingKey() {
return routingKey;
}
public int getDeliveryMode() {
return deliveryMode;
}
public AMQPSettings setDeliveryMode(int deliveryMode) {
if (deliveryMode != 1 && deliveryMode != 2) {
throw new IllegalArgumentException("Delivery mode must be 1 or 2");
}
this.deliveryMode = deliveryMode;
return this;
}
public String getContentType() {
return contentType;
}
/**
* Complete settings from the queue URI.
*
* <p><u>Example for queue:</u>
*
* <pre>
* amqp_queue:myQueue?deliveryMode=1&autoDelete=true&exclusive=true
* </pre>
*View on GitHub (pinned to cf7c3e4a8a)
Solutions
- Set conductor.workflow.event-queues.amqp.deliveryMode to 2 for persistent (recommended) or 1 for non-persistent.
- If the property is optional, ensure a default of 2 is applied in the properties class so the raw int default of 0 is never used.
- Validate the configured value at startup and fail fast with a clear message.
Example fix
// before conductor.workflow.event-queues.amqp.deliveryMode=0 // after conductor.workflow.event-queues.amqp.deliveryMode=2
Defensive patterns
Strategy: validation
Validate before calling
int mode = properties.getDeliveryMode();
if (mode != 1 && mode != 2) {
throw new IllegalStateException(
"conductor.workflow.event-queues.amqp.deliveryMode must be 1 (non-persistent) or 2 (persistent); got " + mode);
} Prevention
- Always set deliveryMode explicitly to 1 or 2 in config.
- Give the property a default of 2 so the raw int default (0) is never used.
- Validate at startup and fail fast with a clear message.
When it happens
Trigger: conductor.workflow.event-queues.amqp.deliveryMode set to 0, 3, or any value outside {1,2}. The AMQPSettings constructor invokes setDeliveryMode(properties.getDeliveryMode()) at construction.
Common situations: Misreading the AMQP spec and setting deliveryMode=0 for 'none' or a large number; typo in config; default primitive int 0 when the property is omitted and the binding does not apply a default.
Related errors
- Exchange name is undefined
- Exchange type is undefined
- Queue name is undefined
- Queue name for publishing is undefined
- Queue URI doesn't matches the expected regexp
AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14).
Data as JSON: /api/errors/97a03c6e1eb7e8db.
Report an issue: GitHub.