Skip to content

Improve job serialization error message with job class name #56398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

alizadeh7091
Copy link
Contributor

This PR improves the error message when a queued job fails to serialize (usually due to Closure or resource property).
Instead of the generic Serialization of 'Closure' is not allowed, this will show which job caused the error.

In large projects with many jobs, debugging such errors becomes very time-consuming.
This small improvement helps identify the problematic job instantly.

This PR does not break anything. It only adds a try/catch around serialize(...) to enrich the error message.

Before

'Serialization of 'Closure' is not allowed'

After

'Failed to serialize job of type [App\Jobs\UpdateSomething]: Serialization of 'Closure' is not allowed'

@taylorotwell taylorotwell merged commit ad8952d into laravel:12.x Jul 24, 2025
60 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