{"record":{"id":"1623acab42d51946","repo":"apache/beam","slug":"no-rabbitmq-channel-available","errorCode":null,"errorMessage":"No RabbitMQ channel available","messagePattern":"No RabbitMQ channel available","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/rabbitmq/src/main/java/org/apache/beam/sdk/io/rabbitmq/RabbitMqIO.java","lineNumber":166,"sourceCode":"\n    public ConnectionHandler(String uri)\n        throws URISyntaxException, NoSuchAlgorithmException, KeyManagementException {\n      connectionFactory = new ConnectionFactory();\n      connectionFactory.setUri(uri);\n      connectionFactory.setAutomaticRecoveryEnabled(true);\n      connectionFactory.setConnectionTimeout(60000);\n      connectionFactory.setNetworkRecoveryInterval(5000);\n      connectionFactory.setRequestedHeartbeat(60);\n      connectionFactory.setTopologyRecoveryEnabled(true);\n      connectionFactory.setRequestedChannelMax(0);\n      connectionFactory.setRequestedFrameMax(0);\n    }\n\n    public void start() throws TimeoutException, IOException {\n      connection = connectionFactory.newConnection();\n      channel = connection.createChannel();\n      if (channel == null) {\n        throw new IOException(\"No RabbitMQ channel available\");\n      }\n    }\n\n    public Channel getChannel() {\n      return this.channel;\n    }\n\n    public void stop() throws IOException {\n      if (channel != null) {\n        try {\n          channel.close();\n        } catch (Exception e) {\n          // ignore\n        }\n      }\n      if (connection != null) {\n        connection.close();\n      }","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/rabbitmq/src/main/java/org/apache/beam/sdk/io/rabbitmq/RabbitMqIO.java#L148-L184","documentation":"RabbitMqIO's unbounded source starts by creating an AMQP connection and channel. If connection.createChannel() returns null (RabbitMQ returns null when the channel cannot be opened, e.g. connection already closing or limit reached), the source throws this IOException at start().","triggerScenarios":"RabbitMqIO.read().apply(...) starting a source where newConnection() succeeds but createChannel() returns null.","commonSituations":"Broker shutting down or restarting during source start; channel_max limit reached on the broker; network flakiness right after connection establishment.","solutions":["Check the RabbitMQ broker logs and health; ensure the broker is up and accepting channels.","Verify the connection's channel_max limit is not exhausted (reduce consumers or raise the limit).","Add retry around pipeline startup for transient broker unavailability.","Confirm credentials/vhost and network connectivity so the connection is fully healthy."],"exampleFix":"// before\nRabbitMqIO.read().withUri(\"amqp://broker:5672\") // broker channel_max exhausted\n// after\nRabbitMqIO.read().withUri(\"amqp://broker:5672\") // and raise channel_max / restart broker, plus pipeline-level retry on startup","handlingStrategy":"retry","validationCode":"// Pre-flight broker check before starting the pipeline\ntry (Connection c = new ConnectionFactory() {{ setHost(host); }}.newConnection()) {\n  if (c.createChannel() == null) throw new IllegalStateException(\"broker refusing channels\");\n}","typeGuard":null,"tryCatchPattern":"try { source.start(); } catch (IOException e) { if (\"No RabbitMQ channel available\".equals(e.getMessage())) { /* backoff and re-create connection/channel */ } }","preventionTips":["Monitor broker health (channel_max, memory alarms) before launching jobs.","Keep consumer count under the broker's channel limits.","Wrap pipeline startup in exponential-backoff retry for transient broker states."],"tags":["rabbitmq","amqp","apache-beam","connection"],"backgroundTag":"connection-refused","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}