{"record":{"id":"1e3fe97dbd58c58f","repo":"alibaba/canal","slug":"failed-to-unsubscribe-with-reason","errorCode":null,"errorMessage":"failed to unSubscribe with reason: ","messagePattern":"failed to unSubscribe with reason: ","errorType":"exception","errorClass":"CanalClientException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleCanalConnector.java","lineNumber":282,"sourceCode":"        waitClientRunning();\n        if (!running) {\n            return;\n        }\n        try {\n            writeWithHeader(Packet.newBuilder()\n                .setType(PacketType.UNSUBSCRIPTION)\n                .setBody(Unsub.newBuilder()\n                    .setDestination(clientIdentity.getDestination())\n                    .setClientId(String.valueOf(clientIdentity.getClientId()))\n                    .build()\n                    .toByteString())\n                .build()\n                .toByteArray());\n            //\n            Packet p = Packet.parseFrom(readNextPacket());\n            Ack ack = Ack.parseFrom(p.getBody());\n            if (ack.getErrorCode() > 0) {\n                throw new CanalClientException(\"failed to unSubscribe with reason: \" + ack.getErrorMessage());\n            }\n        } catch (IOException e) {\n            throw new CanalClientException(e);\n        }\n    }\n\n    @Override\n    public Message get(int batchSize) throws CanalClientException {\n        return get(batchSize, null, null);\n    }\n\n    @Override\n    public Message get(int batchSize, Long timeout, TimeUnit unit) throws CanalClientException {\n        Message message = getWithoutAck(batchSize, timeout, unit);\n        ack(message.getId());\n        return message;\n    }\n","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleCanalConnector.java#L264-L300","documentation":"Error \"failed to unSubscribe with reason: \" thrown in alibaba/canal.","triggerScenarios":"Thrown at client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleCanalConnector.java:282 when the library encounters an invalid state.","commonSituations":"Unsubscribe rejected. Treat as non-fatal during shutdown, but record the reason so server-side subscription state can be cleaned up manually.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}