{"record":{"id":"3d1274ac309adf2a","repo":"apache/incubator-seata","slug":"invalid-client-id-clientid","errorCode":null,"errorMessage":"Invalid Client ID: {clientId}","messagePattern":"Invalid Client ID: (.+?)","errorType":"exception","errorClass":"FrameworkException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/seata/core/rpc/netty/ChannelManager.java","lineNumber":369,"sourceCode":"        }\n        return null;\n    }\n\n    /**\n     * Gets get channel.\n     *\n     * @param resourceId Resource ID\n     * @param clientId   Client ID - ApplicationId:IP:Port\n     * @param tryOtherApp try other app\n     * @return Corresponding channel, NULL if not found.\n     */\n    public static Channel getChannel(String resourceId, String clientId, boolean tryOtherApp) {\n        Channel resultChannel = null;\n\n        String[] clientIdInfo = readClientId(clientId);\n\n        if (clientIdInfo == null || clientIdInfo.length != 3) {\n            throw new FrameworkException(\"Invalid Client ID: \" + clientId);\n        }\n\n        if (StringUtils.isBlank(resourceId)) {\n            if (LOGGER.isInfoEnabled()) {\n                LOGGER.info(\"No channel is available, resourceId is null or empty\");\n            }\n            return null;\n        }\n\n        String targetApplicationId = clientIdInfo[0];\n        String targetIP = clientIdInfo[1];\n        int targetPort = Integer.parseInt(clientIdInfo[2]);\n\n        ConcurrentMap<String, ConcurrentMap<String, ConcurrentMap<Integer, RpcContext>>> applicationIdMap =\n                RM_CHANNELS.get(resourceId);\n\n        if (targetApplicationId == null || applicationIdMap == null || applicationIdMap.isEmpty()) {\n            if (LOGGER.isInfoEnabled()) {","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/core/src/main/java/org/apache/seata/core/rpc/netty/ChannelManager.java#L351-L387","documentation":"FrameworkException thrown by ChannelManager.getChannel when the clientId string does not parse into exactly 3 colon-separated parts. Seata encodes a client identity as ApplicationId:IP:Port; anything else (missing segments, wrong separators, extra colons in IPv6 without brackets, null) is rejected before any channel lookup.","triggerScenarios":"Calling any server API that resolves an RM channel by clientId (e.g. sendSyncRequest(resourceId, clientId, ...)) with a malformed clientId — readClientId returns null or an array whose length != 3.","commonSituations":"Custom code constructing clientIds by hand; IPv6 addresses containing colons that break naive splitting; clientId truncated or re-encoded through a config/serialization layer; version drift where an old client sends a legacy id format.","solutions":["Pass the clientId exactly as delivered in the RegisterRMRequest (applicationId:ip:port), never reconstruct it","For IPv6, use the bracketed form or verify how the client encoded the address","Log the raw clientId at the boundary and validate it with a 3-part split before calling channel APIs","Upgrade client and server to matching seata versions so id formats agree"],"exampleFix":"// before\nString clientId = app + ':' + host + ':' + port + ':extra'; // malformed\nserver.sendSyncRequest(resourceId, clientId, msg, true);\n\n// after\nString clientId = app + ':' + host + ':' + port; // ApplicationId:IP:Port\nif (clientId.split(\":\").length != 3) {\n    throw new IllegalArgumentException(\"bad clientId: \" + clientId);\n}\nserver.sendSyncRequest(resourceId, clientId, msg, true);","handlingStrategy":"validation","validationCode":"static boolean isValidClientId(String clientId) {\n    if (clientId == null) return false;\n    String[] parts = clientId.split(\":\");\n    return parts.length == 3 && !parts[0].isEmpty() && !parts[1].isEmpty()\n        && parts[2].matches(\"\\\\d+\");\n}","typeGuard":"static boolean isValidClientId(String clientId) {\n    return clientId != null && clientId.split(\":\").length == 3;\n}","tryCatchPattern":"catch (FrameworkException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Invalid Client ID\")) {\n        // reject the request with a 4xx-style error; log the raw id\n    }\n}","preventionTips":["Only forward clientIds received from RegisterRMRequest verbatim","Validate id shape at API boundaries (3 colon-separated parts)","Use bracketed IPv6 literals to survive naive splitting"],"tags":["server","client-id","validation"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}