{"record":{"id":"0db8e165a87249ad","repo":"apache/seatunnel","slug":"restoresourcejobid-must-reference-a-historical-ter","errorCode":null,"errorMessage":"restoreSourceJobId must reference a historical terminal source job when restoreMode=CHECKPOINT","messagePattern":"restoreSourceJobId must reference a historical terminal source job when restoreMode=CHECKPOINT","errorType":"exception","errorClass":"JobException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CheckpointRestoreValidator.java","lineNumber":47,"sourceCode":"    private CheckpointRestoreValidator() {}\n\n    static void validate(\n            JobImmutableInformation jobImmutableInformation,\n            long destinationJobId,\n            LongFunction<JobStatus> activeSourceJobStatusResolver) {\n        if (jobImmutableInformation == null\n                || jobImmutableInformation.getRestoreMode() != RestoreMode.CHECKPOINT) {\n            return;\n        }\n\n        Long restoreSourceJobId = jobImmutableInformation.getRestoreSourceJobId();\n        if (restoreSourceJobId == null) {\n            throw new JobException(\n                    \"restoreSourceJobId is required when restoreMode=\"\n                            + jobImmutableInformation.getRestoreMode());\n        }\n        if (restoreSourceJobId == destinationJobId) {\n            throw new JobException(\n                    \"restoreSourceJobId must reference a historical terminal source job when restoreMode=CHECKPOINT\");\n        }\n\n        JobStatus sourceJobStatus =\n                activeSourceJobStatusResolver == null\n                        ? null\n                        : activeSourceJobStatusResolver.apply(restoreSourceJobId);\n        if (sourceJobStatus != null && !sourceJobStatus.isEndState()) {\n            throw new JobException(\n                    String.format(\n                            \"checkpoint restore requires a terminal source job, restoreSourceJobId=%s, current source job status=%s\",\n                            restoreSourceJobId, sourceJobStatus));\n        }\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":63,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CheckpointRestoreValidator.java#L29-L63","documentation":"CheckpointRestoreValidator rejects self-referencing restores: restoreSourceJobId must point to a different, historical job that reached a terminal state. If the provided id equals the destination job's own id, validation fails since a job cannot restore checkpoints from itself.","triggerScenarios":"validate() is called with restoreMode=CHECKPOINT and restoreSourceJobId == destinationJobId (both ids identical) during job submission.","commonSituations":"Script or automation reusing the same variable for the new job id and the restore source id; copy-paste of the job id field into the restore field; retry loops resubmitting with the previous (rejected) job id.","solutions":["Supply the id of the ORIGINAL historical job whose checkpoints should be restored.","Ensure the destination job id is generated fresh for the new submission, not copied from the source.","Check automation scripts for a variable shadowing the two ids."],"exampleFix":"// before: same id for both\nLong jobId = 883745192014848L;\nbuilder.restoreMode(CHECKPOINT).restoreSourceJobId(jobId).jobId(jobId);\n// after\nbuilder.jobId(newRandomJobId()).restoreMode(CHECKPOINT).restoreSourceJobId(883745192014848L);","handlingStrategy":"validation","validationCode":"if (restoreMode == RestoreMode.CHECKPOINT && restoreSourceJobId.equals(destinationJobId)) {\n  throw new IllegalArgumentException(\"restoreSourceJobId must differ from the new job id\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  client.submitJob(request);\n} catch (JobException e) {\n  if (e.getMessage().contains(\"must reference a historical terminal source job\")) {\n    // regenerate destination job id, keep original source id\n  }\n}","preventionTips":["Always generate a fresh job id for the new submission","Keep source job id as an immutable constant in restore scripts","Never reuse a rejected submission's job id on retry without regenerating"],"tags":["checkpoint-restore","job-submission","invalid-argument-value","zeta-engine"],"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-14T11:17:12.474Z"}