{"record":{"id":"69c15bdb0bff49d0","repo":"conductor-oss/conductor","slug":"connection-factory-is-undefined","errorCode":null,"errorMessage":"Connection factory is undefined","messagePattern":"Connection factory is undefined","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"amqp/src/main/java/com/netflix/conductor/contribs/queue/amqp/AMQPObservableQueue.java","lineNumber":80,"sourceCode":"    private final String QUEUE_TYPE = \"x-queue-type\";\n    private final int batchSize;\n    private final boolean useExchange;\n    private int pollTimeInMS;\n    private AMQPConnection amqpConnection;\n\n    protected LinkedBlockingQueue<Message> messages = new LinkedBlockingQueue<>();\n    private volatile boolean running;\n\n    public AMQPObservableQueue(\n            ConnectionFactory factory,\n            Address[] addresses,\n            boolean useExchange,\n            AMQPSettings settings,\n            AMQPRetryPattern retrySettings,\n            int batchSize,\n            int pollTimeInMS) {\n        if (factory == null) {\n            throw new IllegalArgumentException(\"Connection factory is undefined\");\n        }\n        if (addresses == null || addresses.length == 0) {\n            throw new IllegalArgumentException(\"Addresses are undefined\");\n        }\n        if (settings == null) {\n            throw new IllegalArgumentException(\"Settings are undefined\");\n        }\n        if (batchSize <= 0) {\n            throw new IllegalArgumentException(\"Batch size must be greater than 0\");\n        }\n        if (pollTimeInMS <= 0) {\n            throw new IllegalArgumentException(\"Poll time must be greater than 0 ms\");\n        }\n        this.useExchange = useExchange;\n        this.settings = settings;\n        this.batchSize = batchSize;\n        this.amqpConnection = AMQPConnection.getInstance(factory, addresses, retrySettings);\n        this.retrySettings = retrySettings;","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/amqp/src/main/java/com/netflix/conductor/contribs/queue/amqp/AMQPObservableQueue.java#L62-L98","documentation":"Constructor guard on AMQPObservableQueue: the ConnectionFactory argument is null. Thrown during construction before any network activity. The Builder always builds a factory via buildConnectionFactory(), so reaching this guard means the public constructor was used directly with a null factory (typical in tests or custom wiring).","triggerScenarios":"Calling `new AMQPObservableQueue(null, addresses, ...)` directly instead of through AMQPObservableQueue.Builder, which guarantees a non-null factory.","commonSituations":"Unit-test wiring that passes null for the factory; a custom queue factory that bypasses the Builder.","solutions":["Construct via AMQPObservableQueue.Builder, which builds the ConnectionFactory from properties.","If constructing directly, pass a non-null ConnectionFactory (e.g. new ConnectionFactory()).","Add a null-check in the calling code before constructing."],"exampleFix":"// before: direct construction with null factory\nnew AMQPObservableQueue(null, addresses, useExchange, settings, retry, batchSize, pollTimeInMS);\n\n// after: use the Builder, which builds the factory from properties\nAMQPObservableQueue q = new AMQPObservableQueue.Builder(properties).build(useExchange, queueURI, queueType);","handlingStrategy":"validation","validationCode":"// Validate before constructing directly\nif (factory == null) {\n    throw new IllegalArgumentException(\"factory required; use AMQPObservableQueue.Builder\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Construct AMQPObservableQueue via the Builder, which always builds a ConnectionFactory.","If constructing directly, assert all arguments non-null before the call.","Cover direct-construction paths in unit tests."],"tags":["amqp","config","validation"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}