{"record":{"id":"3886efd86abc31ba","repo":"apache/incubator-seata","slug":"client-is-not-connected","errorCode":null,"errorMessage":"client is not connected","messagePattern":"client is not connected","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingServer.java","lineNumber":84,"sourceCode":"        serverBootstrap = new NettyServerBootstrap(nettyServerConfig);\n        serverBootstrap.setChannelHandlers(new ServerHandler());\n    }\n\n    @Override\n    public Object sendSyncRequest(String resourceId, String clientId, Object msg, boolean tryOtherApp)\n            throws TimeoutException, IOException {\n        Channel channel = ChannelManager.getChannel(resourceId, clientId, tryOtherApp);\n        if (channel == null) {\n            throw new IOException(\"rm client is not connected. dbkey:\" + resourceId + \",clientId:\" + clientId);\n        }\n        RpcMessage rpcMessage = buildRequestMessage(msg, ProtocolConstants.MSGTYPE_RESQUEST_SYNC);\n        return super.sendSync(channel, rpcMessage, NettyServerConfig.getRpcRequestTimeout());\n    }\n\n    @Override\n    public Object sendSyncRequest(Channel channel, Object msg) throws TimeoutException, IOException {\n        if (channel == null) {\n            throw new IOException(\"client is not connected\");\n        }\n        RpcMessage rpcMessage = buildRequestMessage(msg, ProtocolConstants.MSGTYPE_RESQUEST_SYNC);\n        return super.sendSync(channel, rpcMessage, NettyServerConfig.getRpcRequestTimeout());\n    }\n\n    @Override\n    public void sendAsyncRequest(Channel channel, Object msg) throws IOException {\n        if (channel == null) {\n            throw new IOException(\"client is not connected\");\n        }\n        RpcMessage rpcMessage = buildRequestMessage(msg, ProtocolConstants.MSGTYPE_RESQUEST_ONEWAY);\n        super.sendAsync(channel, rpcMessage);\n    }\n\n    @Override\n    public void sendAsyncResponse(RpcMessage rpcMessage, Channel channel, Object msg) {\n        Channel clientChannel = channel;\n        if (!(msg instanceof HeartbeatMessage)) {","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingServer.java#L66-L102","documentation":"Server-side error from AbstractNettyRemotingServer.sendSyncRequest(Channel, Object): the caller passed a null channel, so the TC refuses to build and send the sync RPC. It is a programming/lookup bug on the server side rather than a network condition — the channel reference must be obtained (and non-null) before this overload is used.","triggerScenarios":"Calling sendSyncRequest((Channel) null, msg) directly, or passing a channel variable that a prior lookup (e.g. ChannelManager.getChannel) returned null for without a null check.","commonSituations":"Custom server-side code or a fork of seata-server that fetches a client channel and forwards it without checking; races where the channel was closed and nulled between fetch and send.","solutions":["Fetch the channel via ChannelManager with the resourceId/clientId overload that throws a descriptive error, instead of managing channels manually","Guard with a null check and re-resolve the channel before retrying the send","If writing a custom processor, follow the existing processors: they resolve the channel from the incoming message context, never cache it"],"exampleFix":"// before\nserver.sendSyncRequest(channel, request); // channel may be null\n\n// after\nChannel channel = ChannelManager.getChannel(resourceId, clientId, tryOtherApp);\nif (channel == null || !channel.isActive()) {\n    throw new IOException(\"client is not connected: \" + clientId);\n}\nserver.sendSyncRequest(channel, request);","handlingStrategy":"validation","validationCode":"Channel ch = ChannelManager.getChannel(resourceId, clientId, tryOtherApp);\nif (ch == null) throw new IOException(\"client not connected: \" + clientId);\nserver.sendSyncRequest(ch, msg);","typeGuard":null,"tryCatchPattern":"catch (IOException e) {\n    if (\"client is not connected\".equals(e.getMessage())) { /* re-resolve channel and retry once */ }\n}","preventionTips":["Always resolve the channel through ChannelManager immediately before sending","Check isActive() in addition to non-null","Avoid custom channel caching in server-side processors"],"tags":["server","null-channel","netty"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}