{"record":{"id":"97a03c6e1eb7e8db","repo":"conductor-oss/conductor","slug":"delivery-mode-must-be-1-or-2","errorCode":null,"errorMessage":"Delivery mode must be 1 or 2","messagePattern":"Delivery mode must be 1 or 2","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"amqp/src/main/java/com/netflix/conductor/contribs/queue/amqp/util/AMQPSettings.java","lineNumber":138,"sourceCode":"        }\n        return exchangeBoundQueueName;\n    }\n\n    public String getExchangeType() {\n        return exchangeType;\n    }\n\n    public String getRoutingKey() {\n        return routingKey;\n    }\n\n    public int getDeliveryMode() {\n        return deliveryMode;\n    }\n\n    public AMQPSettings setDeliveryMode(int deliveryMode) {\n        if (deliveryMode != 1 && deliveryMode != 2) {\n            throw new IllegalArgumentException(\"Delivery mode must be 1 or 2\");\n        }\n        this.deliveryMode = deliveryMode;\n        return this;\n    }\n\n    public String getContentType() {\n        return contentType;\n    }\n\n    /**\n     * Complete settings from the queue URI.\n     *\n     * <p><u>Example for queue:</u>\n     *\n     * <pre>\n     * amqp_queue:myQueue?deliveryMode=1&autoDelete=true&exclusive=true\n     * </pre>\n     *","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/amqp/src/main/java/com/netflix/conductor/contribs/queue/amqp/util/AMQPSettings.java#L120-L156","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nconductor.workflow.event-queues.amqp.deliveryMode=0\n// after\nconductor.workflow.event-queues.amqp.deliveryMode=2","handlingStrategy":"validation","validationCode":"int mode = properties.getDeliveryMode();\nif (mode != 1 && mode != 2) {\n    throw new IllegalStateException(\n        \"conductor.workflow.event-queues.amqp.deliveryMode must be 1 (non-persistent) or 2 (persistent); got \" + mode);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["amqp","configuration","validation"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}