{"record":{"id":"550c365966827244","repo":"apache/seatunnel","slug":"unrecognized-command-prefix-got","errorCode":null,"errorMessage":"Unrecognized command prefix, got: {}","messagePattern":"Unrecognized command prefix, got: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/protocol/IngressProtocolHandler.java","lineNumber":100,"sourceCode":"        while (isActive.getAsBoolean()) {\n            String record;\n            try {\n                record = channel.readLine();\n            } catch (SocketTimeoutException timeoutException) {\n                continue;\n            }\n            if (record == null) {\n                return;\n            }\n            channel.writeLine(dispatch(record));\n        }\n    }\n\n    private String dispatch(String request) {\n        IngressCommand command = IngressCommand.matchPrefix(request);\n        if (command == null) {\n            log.warn(\n                    \"Unrecognized command prefix, got: {}\",\n                    EdgeSocketLogUtils.abbreviateForLog(request));\n            return EdgeSocketResponseCode.BAD_REQUEST.getCode();\n        }\n        switch (command) {\n            case COMMIT:\n                return dispatchCommit(request);\n            case BATCH:\n                return dispatchBatch(request);\n            default:\n                log.warn(\"Command {} is not dispatched yet\", command);\n                return EdgeSocketResponseCode.BAD_REQUEST.getCode();\n        }\n    }\n\n    private String dispatchCommit(String request) {\n        Long batchId = parseBatchId(request, IngressCommand.COMMIT.prefix());\n        if (batchId == null || batchId <= 0) {\n            log.warn(","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/protocol/IngressProtocolHandler.java#L82-L118","documentation":"Logged in dispatch() when IngressCommand.matchPrefix cannot map the first line of a request to any known command (COMMIT or BATCH). The server replies with the BAD_REQUEST response code and keeps the connection open. It indicates the client is speaking a protocol the server does not recognize.","triggerScenarios":"receiveLoop reads a line and hands it to dispatch; the line's prefix matches no IngressCommand — e.g. empty line, wrong/misspelled command word, or a raw payload sent before the BATCH prefix.","commonSituations":"Collector client using an older/newer protocol version than the server, sending payloads without the required command prefix, TCP framing issues splitting or corrupting the first line, a health-check probe sending plain HTTP to the raw TCP port.","solutions":["Log the abbreviated request (EdgeSocketLogUtils.abbreviateForLog output) and align the collector with the expected 'COMMIT <id>' / 'BATCH <id>:<payload>' format.","Check collector and server versions for protocol compatibility.","Ensure the collector writes complete, newline-terminated command lines.","Verify no non-collector client (e.g. load balancer health check) is hitting this port."],"exampleFix":"// before (client)\nwriter.write(batchId + \":\" + payload); // missing command prefix\n// after\nwriter.write(\"BATCH \" + batchId + \":\" + payload + \"\\n\");","handlingStrategy":"validation","validationCode":"if (line == null || !(line.startsWith(\"COMMIT \") || line.startsWith(\"BATCH \"))) { throw new IllegalArgumentException(\"request must start with COMMIT or BATCH prefix: \" + line); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize command-line construction in a client helper instead of hand-writing strings","Pin collector and server to matching protocol versions","Always newline-terminate writes and flush per command","Add a client-side smoke test that round-trips COMMIT and BATCH against a local server"],"tags":["protocol","tcp","bad-request"],"backgroundTag":"invalid-argument-format","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}