{"record":{"id":"51893cf8ce8af9ce","repo":"apache/seatunnel","slug":"the-jobid-must-not-be-empty","errorCode":null,"errorMessage":"The jobId must not be empty.","messagePattern":"The jobId must not 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/servlet/CheckpointHistoryServlet.java","lineNumber":45,"sourceCode":"import javax.servlet.http.HttpServletResponse;\n\nimport java.io.IOException;\n\npublic class CheckpointHistoryServlet extends BaseServlet {\n\n    private final CheckpointMonitorRestService restService;\n\n    public CheckpointHistoryServlet(NodeEngineImpl nodeEngine) {\n        super(nodeEngine);\n        this.restService = new CheckpointMonitorRestService(nodeEngine);\n    }\n\n    @Override\n    protected void doGet(HttpServletRequest req, HttpServletResponse resp)\n            throws ServletException, IOException {\n        String jobIdStr = req.getPathInfo();\n        if (jobIdStr == null || jobIdStr.length() <= 1) {\n            throw new IllegalArgumentException(\"The jobId must not be empty.\");\n        }\n        long jobId = Long.parseLong(jobIdStr.substring(1));\n        Integer pipelineId =\n                req.getParameter(\"pipelineId\") == null\n                        ? null\n                        : Integer.parseInt(req.getParameter(\"pipelineId\"));\n        int limit =\n                req.getParameter(\"limit\") == null\n                        ? 20\n                        : Integer.parseInt(req.getParameter(\"limit\"));\n        CheckpointStatus status = null;\n        if (req.getParameter(\"status\") != null) {\n            status = CheckpointStatus.valueOf(req.getParameter(\"status\").toUpperCase());\n        }\n        writeJson(resp, restService.getHistory(jobId, pipelineId, limit, status));\n    }\n}\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/servlet/CheckpointHistoryServlet.java#L27-L63","documentation":"CheckpointHistoryServlet.doGet reads the jobId from the request path info (form /jobId). If the path is missing, empty, or only a slash, it throws IllegalArgumentException because a numeric job id is mandatory to look up checkpoint history. Long.parseLong would otherwise fail on garbage, so the explicit check guards the empty case.","triggerScenarios":"GET to the checkpoint-history endpoint without a trailing /<jobId> path segment, e.g. GET /checkpoint-history/ or /checkpoint-history.","commonSituations":"Client omits the job id when polling history after a job failed to submit; reverse-proxy rewrites drop the path suffix; users copy the endpoint URL without appending the id; bookmarking the base URL.","solutions":["Append the numeric job id to the URL path, e.g. GET /checkpoint-history/<jobId>","Validate the jobId is present and numeric in the client before calling","Ensure proxies/gateways do not strip the trailing path segment","Catch IllegalArgumentException client-side and surface a 400 with a helpful message"],"exampleFix":"// before\nresp = get(base + \"/checkpoint-history/\"); // missing id\n// after\nresp = get(base + \"/checkpoint-history/\" + jobId); // jobId = 918273645","handlingStrategy":"validation","validationCode":"if (jobId == null || jobId <= 0) throw new IllegalArgumentException(\"jobId required\");\nURL url = base + \"/checkpoint-history/\" + jobId;","typeGuard":"boolean hasJobId(String pathInfo) { return pathInfo != null && pathInfo.length() > 1 && pathInfo.substring(1).matches(\"\\\\d+\"); }","tryCatchPattern":"try { resp = getHistory(jobId); } catch (IllegalArgumentException e) { show(\"Provide a numeric jobId in the path\"); }","preventionTips":["Persist the jobId returned at submission time","Build URLs from typed jobId fields, never string concatenation of nullable values","Test endpoints with the no-id URL to confirm 400 responses"],"tags":["rest","validation","jobid"],"backgroundTag":"empty-required-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}