{"record":{"id":"968cfac43d68f182","repo":"apache/seatunnel","slug":"jobid-cannot-be-empty","errorCode":null,"errorMessage":"jobId cannot be empty.","messagePattern":"jobId cannot be empty\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/service/BaseService.java","lineNumber":1266,"sourceCode":"\n    protected JsonNode requestHandle(byte[] requestBody) {\n        if (requestBody.length == 0) {\n            throw new IllegalArgumentException(\"Request body is empty.\");\n        }\n        JsonNode requestBodyJsonNode;\n        try {\n            requestBodyJsonNode = RestUtil.convertByteToJsonNode(requestBody);\n        } catch (IOException e) {\n            throw new IllegalArgumentException(\"Invalid JSON format in request body.\");\n        }\n        return requestBodyJsonNode;\n    }\n\n    protected void handleStopJob(\n            Map<String, Object> map, SeaTunnelServer seaTunnelServer, Node node) {\n        boolean isStopWithSavePoint = false;\n        if (map.get(RestConstant.JOB_ID) == null) {\n            throw new IllegalArgumentException(\"jobId cannot be empty.\");\n        }\n        long jobId = Long.parseLong(map.get(RestConstant.JOB_ID).toString());\n        if (map.get(RestConstant.IS_STOP_WITH_SAVE_POINT) != null) {\n            isStopWithSavePoint =\n                    Boolean.parseBoolean(map.get(RestConstant.IS_STOP_WITH_SAVE_POINT).toString());\n        }\n        boolean forceStop = false;\n        if (map.get(RestConstant.FORCE) != null) {\n            forceStop = Boolean.parseBoolean(map.get(RestConstant.FORCE).toString());\n        }\n\n        if (!seaTunnelServer.isMasterNode()) {\n            if (forceStop) {\n                NodeEngineUtil.sendOperationToMasterNode(\n                                node.nodeEngine, new CancelJobOperation(jobId, true))\n                        .join();\n                return;\n            }","sourceCodeStart":1248,"sourceCodeEnd":1284,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/service/BaseService.java#L1248-L1284","documentation":"handleStopJob requires a jobId field in the parsed request body. If map.get(RestConstant.JOB_ID) is null, it throws IllegalArgumentException(\"jobId cannot be empty.\") since the stop operation cannot identify which job to stop.","triggerScenarios":"POST /stop-job (or similar) with a JSON body lacking the jobId key, or containing it as null.","commonSituations":"Copy-pasted body template with placeholder not replaced; wrong field name (e.g. job_id instead of jobId); jobId lost by client serialization.","solutions":["Include jobId in the JSON body: {\"jobId\":\"<running-job-id>\"}","Get the correct jobId from GET /running-jobs before stopping","Check field naming matches RestConstant.JOB_ID (\"jobId\") exactly"],"exampleFix":"// before\n{\"isStopWithSavePoint\": true}\n// after\n{\"jobId\": \"863300353636515841\", \"isStopWithSavePoint\": true}","handlingStrategy":"validation","validationCode":"if (payload.jobId == null || payload.jobId === '') throw new Error('jobId is required to stop a job');","typeGuard":null,"tryCatchPattern":"try {\n    await post('/stop-job', payload);\n} catch (e) {\n    if (String(e).includes('jobId cannot be empty')) {\n        // fetch running-jobs and set jobId\n    }\n}","preventionTips":["Fetch jobId from GET /running-jobs before stop calls","Use exact field name jobId","Null-check body fields before submission"],"tags":["rest-api","validation","job-management"],"backgroundTag":"missing-required-argument","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}