{"record":{"id":"9bc489dc116f00ad","repo":"alibaba/canal","slug":"error-9bc489","errorCode":null,"errorMessage":"error","messagePattern":"error","errorType":"exception","errorClass":"CanalClientException","httpStatus":null,"severity":"error","filePath":"connector/rabbitmq-connector/src/main/java/com/alibaba/otter/canal/connector/rabbitmq/consumer/CanalRabbitMQConsumer.java","lineNumber":128,"sourceCode":"        if (connect == null) {\n            this.connect();\n        }\n\n        Consumer consumer = new DefaultConsumer(channel) {\n\n            @Override\n            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties,\n                                       byte[] body) throws IOException {\n\n                if (body != null) {\n                    channel.basicAck(envelope.getDeliveryTag(), process(body));\n                }\n            }\n        };\n        try {\n            channel.basicConsume(queueName, false, consumer);\n        } catch (IOException e) {\n            throw new CanalClientException(\"error\", e);\n        }\n    }\n\n    private boolean process(byte[] messageData) {\n        if (logger.isDebugEnabled()) {\n            logger.debug(\"Get Message: {}\", new String(messageData));\n        }\n        List<CommonMessage> messageList = new ArrayList<>();\n        if (!flatMessage) {\n            Message message = CanalMessageSerializerUtil.deserializer(messageData);\n            messageList.addAll(MessageUtil.convert(message));\n        } else {\n            CommonMessage commonMessage = JSON.parseObject(messageData, CommonMessage.class);\n            messageList.add(commonMessage);\n        }\n        ConsumerBatchMessage<CommonMessage> batchMessage = new ConsumerBatchMessage<>(messageList);\n        try {\n            messageBlockingQueue.put(batchMessage);","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/connector/rabbitmq-connector/src/main/java/com/alibaba/otter/canal/connector/rabbitmq/consumer/CanalRabbitMQConsumer.java#L110-L146","documentation":"Thrown by CanalRabbitMQConsumer.connect when channel.basicConsume(queueName, false, consumer) raises an IOException. newConnection/createChannel succeeded, but registering the consumer on the queue failed — most often because the queue does not exist or the channel was closed between creation and the consume call.","triggerScenarios":"channel.basicConsume() at line 132 throws IOException. Causes: the target queue does not exist (consumer does not declare it); the channel was torn down (channel-level exception from a prior operation); access refused on the queue.","commonSituations":"Queue name typo (rabbitmq.queue); queue not pre-declared on the broker and the consumer does not declare it; permissions/TopicAuth blocking the consume; a previous channel error left the channel in a closed state.","solutions":["Ensure the queue exists on the broker, or declare it (channel.queueDeclare) before basicConsume if the consumer is responsible for creation.","Verify the rabbitmq.queue property matches an existing, consumable queue and the user has read permission.","If the channel may have errored earlier, recreate the channel before consuming."],"exampleFix":"// before\ntry {\n    channel.basicConsume(queueName, false, consumer);\n} catch (IOException e) {\n    throw new CanalClientException(\"error\", e);\n}\n\n// after — declare-if-missing and a descriptive error\ntry {\n    channel.queueDeclarePassive(queueName); // fails fast if queue missing\n    channel.basicConsume(queueName, false, consumer);\n} catch (IOException e) {\n    throw new CanalClientException(\"basicConsume failed for queue \" + queueName, e);\n}","handlingStrategy":"validation","validationCode":"// Ensure the queue exists before consuming\nchannel.queueDeclarePassive(queueName);","typeGuard":null,"tryCatchPattern":"try {\n    channel.queueDeclarePassive(queueName);\n    channel.basicConsume(queueName, false, consumer);\n} catch (IOException e) {\n    throw new CanalClientException(\"basicConsume failed for queue \" + queueName, e);\n}","preventionTips":["Ensure the queue is declared on the broker (or declare it in the consumer).","Verify the user has read permission on the queue.","Recreate the channel if a prior channel-level error occurred."],"tags":["rabbitmq","consumer","canal-connector","configuration"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}