alibaba/canal · error · CanalClientException
failed to unSubscribe with reason:
Error message
failed to unSubscribe with reason:
What it means
Error "failed to unSubscribe with reason: " thrown in alibaba/canal.
Source
Thrown at client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleCanalConnector.java:282
waitClientRunning();
if (!running) {
return;
}
try {
writeWithHeader(Packet.newBuilder()
.setType(PacketType.UNSUBSCRIPTION)
.setBody(Unsub.newBuilder()
.setDestination(clientIdentity.getDestination())
.setClientId(String.valueOf(clientIdentity.getClientId()))
.build()
.toByteString())
.build()
.toByteArray());
//
Packet p = Packet.parseFrom(readNextPacket());
Ack ack = Ack.parseFrom(p.getBody());
if (ack.getErrorCode() > 0) {
throw new CanalClientException("failed to unSubscribe with reason: " + ack.getErrorMessage());
}
} catch (IOException e) {
throw new CanalClientException(e);
}
}
@Override
public Message get(int batchSize) throws CanalClientException {
return get(batchSize, null, null);
}
@Override
public Message get(int batchSize, Long timeout, TimeUnit unit) throws CanalClientException {
Message message = getWithoutAck(batchSize, timeout, unit);
ack(message.getId());
return message;
}
View on GitHub (pinned to 87be50e876)
Solutions
- Only call unSubscribe() after a successful subscribe(); check the client state before unsubscribing.
- If the server already dropped the subscription (e.g. after reconnect), ignore this error and re-subscribe on the new connection.
When it happens
Trigger: Thrown at client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleCanalConnector.java:282 when the library encounters an invalid state.
Common situations: Unsubscribe rejected. Treat as non-fatal during shutdown, but record the reason so server-side subscription state can be cleaned up manually.
AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14).
Data as JSON: /api/errors/1e3fe97dbd58c58f.
Report an issue: GitHub.