{"record":{"id":"fa17abe5a30bbcfe","repo":"apache/seatunnel","slug":"invalid-commit-batchid-in-request","errorCode":null,"errorMessage":"Invalid COMMIT batchId in request: {}","messagePattern":"Invalid COMMIT batchId in request: (.+?)","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":119,"sourceCode":"                    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(\n                    \"Invalid COMMIT batchId in request: {}\",\n                    EdgeSocketLogUtils.abbreviateForLog(request));\n            return EdgeSocketResponseCode.INVALID_PARAM.getCode();\n        }\n        return handler.handleCommitRequest(batchId);\n    }\n\n    private String dispatchBatch(String request) {\n        int separatorIndex = request.indexOf(':', IngressCommand.BATCH.prefix().length());\n        if (separatorIndex < 0) {\n            log.warn(\n                    \"Malformed BATCH request, missing payload separator: {}\",\n                    EdgeSocketLogUtils.abbreviateForLog(request));\n            return EdgeSocketResponseCode.BAD_REQUEST.getCode();\n        }\n        Long batchId =\n                parseBatchId(request.substring(0, separatorIndex), IngressCommand.BATCH.prefix());\n        if (batchId == null || batchId <= 0) {\n            log.warn(","sourceCodeStart":101,"sourceCodeEnd":137,"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#L101-L137","documentation":"Logged by dispatchCommit() when the batchId parsed from a 'COMMIT <id>' request is missing, non-numeric, or not positive. The server replies with INVALID_PARAM and does not forward the request to the handler. It guards the sink's commit protocol against malformed batch identifiers.","triggerScenarios":"A 'COMMIT' line whose argument fails parseBatchId: absent argument, non-numeric text, or a value <= 0 such as 'COMMIT 0' or 'COMMIT -1'.","commonSituations":"Collector bug emitting an uninitialized/null batch id, id corruption from a broken TCP framing layer, client sending 'COMMIT' with no argument after a failed batch allocation.","solutions":["Fix the collector to always send a positive numeric batch id with COMMIT.","Log the abbreviated request to see exactly what was received and correct the format to 'COMMIT <positive-long>'.","Check the collector's batch-id allocation logic for null/unset ids after errors."],"exampleFix":"// before (client)\nString cmd = \"COMMIT \" + batchId; // batchId was null -> \"COMMIT null\"\n// after\nif (batchId != null && batchId > 0) { writer.write(\"COMMIT \" + batchId + \"\\n\"); }","handlingStrategy":"validation","validationCode":"if (batchId == null || batchId <= 0) { throw new IllegalArgumentException(\"COMMIT requires a positive numeric batchId, got: \" + batchId); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Initialize batch ids to 1, not 0","Assert batchId > 0 before writing the COMMIT line","Handle batch allocation failure by aborting the batch rather than sending a null id"],"tags":["protocol","validation","batch-id"],"backgroundTag":"invalid-argument-value","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"}