alibaba/canal · error · CanalClientException
should connect first
Error message
should connect first
What it means
Error "should connect first" thrown in alibaba/canal.
Source
Thrown at client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleCanalConnector.java:469
}
return address;
}
public void processActiveExit() {
mutex.set(false);
doDisconnect();
}
});
}
}
private void waitClientRunning() {
try {
if (zkClientx != null) {
if (!connected) {// 未调用connect
throw new CanalClientException("should connect first");
}
running = true;
mutex.get();// 阻塞等待
} else {
// 单机模式直接设置为running
running = true;
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new CanalClientException(e);
}
}
public boolean checkValid() {
if (zkClientx != null) {
return mutex.state();
} else {View on GitHub (pinned to 87be50e876)
Solutions
- Call connect() (and subscribe() where required) before calling get/getWithoutAck/ack/rollback.
- Guard consumption with connector state checks or use the recommended connect-subscribe-get-ack loop pattern from canal examples.
When it happens
Trigger: Thrown at client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleCanalConnector.java:469 when the library encounters an invalid state.
Common situations: Operation attempted before connect(). Guard every public method with a connected-state check and fail fast instead of issuing IO on a null channel.
AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14).
Data as JSON: /api/errors/9ec68ed747df48b0.
Report an issue: GitHub.