Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

axtrics's avatar

failed() method not getting hit after a job is failed

Hi,

I am running few jobs and trying to setup a failed() public method within the job itself. Though even after throw a manual exception i can see that the job is failed and sent into failed_jobs table but the failed method is not getting hit.

Here is my code

public function failed(Exception $exception) { // Send user notification of failure, etc... Log::channel('jobs')->error('Catalog Sync Failed for Merchant'); }

Kindly note that Failed Jobs Event is getting hit and i am using https://github.com/spatie/laravel-failed-job-monitor to manage that.

What is wrong here? Can anybody help? I am on Laravel 6+

0 likes
1 reply
bobbybouwmann's avatar

Did you restart your queue worker after changing the code? Your worker caches the PHP code, so on every change you need to restart the queue. The same goes for deployments.

If you set your drive to sync you can much easier test this. This way you don't have to restart the worker, because there is no worker.

Otherwise, this should work out of the box!

Please or to participate in this conversation.