You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SimpleJobOperator.restart(JobExecution) masks the real failure reason with a misleading "job execution already running" message #5439
SimpleJobOperator.restart(JobExecution) wraps every exception thrown by run(...) into a JobRestartException whose message is hardcoded to "job execution already running", discarding the real, accurate reason the job could not be restarted.
Details
TaskExecutorJobLauncher.createJobExecution(...) already throws specific, accurate exceptions for non-restartable conditions. For example, when the previous execution (or one of its step executions) ended in UNKNOWN status:
thrownewJobRestartException("Cannot restart job from UNKNOWN status. "
+ "The last execution ended with a failure that could not be rolled back, "
+ "so it may be dangerous to proceed. Manual intervention is probably necessary.");
But SimpleJobOperator.restart(JobExecution) catches the broad Exception and rebuilds a new message:
So the accurate message is demoted to the cause, and the top-level message wrongly says "job execution already running" — even though the job is not running (it's UNKNOWN, or already complete, or had invalid parameters).
Impact
Users and logs see "job execution already running" when the real problem is an UNKNOWN-status execution requiring manual intervention — sending people down the wrong debugging path. The same masking also mislabels JobInstanceAlreadyCompleteException and InvalidJobParametersException.
Expected
restart(JobExecution) should surface the real reason: propagate the launcher's JobRestartException as-is, and only use the "already running" message for the genuinely running case (JobExecutionAlreadyRunningException).
How to reproduce
Restart a JobExecution whose last execution ended in UNKNOWN status (e.g. when a step's final metadata save fails under a concurrent stop). The resulting JobRestartException reports "job execution already running" instead of the UNKNOWN-status reason.
Suggested fix
Replace the broad catch (Exception e) with per-type handling: wrap only JobExecutionAlreadyRunningException as "already running", rethrow JobRestartException unchanged, and wrap JobInstanceAlreadyCompleteException / InvalidJobParametersException with their own messages.
This looks like a straightforward contract bug in SimpleJobOperator.restart(JobExecution): the wrapper exception should add context without replacing the launcher's specific restart reason. A regression test could cover an UNKNOWN previous execution and assert the final JobRestartException message still contains the original “Cannot restart job from UNKNOWN status” text, with the original exception preserved as the cause. That would keep the operator API helpful without changing the launcher behavior.
Activity
Surface the real reason a job execution cannot be restarted
Surface the real reason a job execution cannot be restarted
Surface the real reason a job execution cannot be restarted
hiSandog commentedon Jul 3, 2026
This looks like a straightforward contract bug in
SimpleJobOperator.restart(JobExecution): the wrapper exception should add context without replacing the launcher's specific restart reason. A regression test could cover anUNKNOWNprevious execution and assert the finalJobRestartExceptionmessage still contains the original “Cannot restart job from UNKNOWN status” text, with the original exception preserved as the cause. That would keep the operator API helpful without changing the launcher behavior.Surface the real reason a job execution cannot be restarted
Surface the real reason a job execution cannot be restarted