Skip to content

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
@alizadeh7091 alizadeh7091 deleted the fix-better-serialization-error branch August 2, 2025 05:45
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