Skip to content

[13.x] Don't let a job with a deleted model stop queue:retry - #62124

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
xurshudyan:queue-retry-missing-models
Oct 21, 2026
Merged

taylorotwell merged 1 commit into
laravel:13.xfrom
xurshudyan:queue-retry-missing-models

Conversation

@xurshudyan

Copy link
Copy Markdown
Contributor

queue:retry unserializes each failed job before pushing it back, to read retryUntil() and the queueable options. Unserializing loads the job's models from the database, so if a model was deleted after the job failed, it throws ModelNotFoundException and the whole command stops.

All the jobs after that one are left in failed_jobs. The broken job stays there too, so running the command again stops at the same job, and nothing can be retried until you find it and forget it by hand. $deleteWhenMissingModels doesn't help, because only the worker checks it and the job never gets that far.

This was reported in #44949, which was closed because there was no reproduction. The added tests reproduce it.

With this PR, when the models can't be found, the payload is pushed back as it is. The worker then deletes the job if it uses $deleteWhenMissingModels, or fails it again otherwise, and the remaining jobs are retried as usual.

@taylorotwell
taylorotwell merged commit 6f30257 into laravel:13.x Oct 21, 2026
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants