Skip to content

Laravel queue monitoring: failed jobs and dead workers

Published December 1, 2026 · Updated December 3, 2026

A Laravel queue fails in three ways, and only one of them leaves a trace. A job that throws ends up in the failed_jobs table. A worker that died or froze produces nothing at all: jobs simply stop being processed. A queue whose workers cannot keep up grows a backlog. Monitoring a queue means watching all three, and the second one needs a heartbeat, not an error tracker.

The three ways a queue fails

FailureWhat you seeWhat catches it
A job throws until it runs out of attemptsA row in failed_jobs, an exception per attemptqueue:failed, the failed() method, Queue::failing, your exception tracker
The worker is dead, paused or stuckNothing. No exception, no log lineSupervisor for restarts, a heartbeat for alerting
Jobs wait longer and longerSlow emails, late exports, user complaintsqueue:monitor, Horizon's wait time notifications, a lag measurement

Most teams cover the first line and discover the second one the day a customer asks why their invoice never arrived.

Failed jobs: the failed_jobs table

When a job exceeds its maximum number of attempts, Laravel considers it failed and stores it in the failed_jobs table, with its payload and the exception. New applications ship with that migration. If yours does not have it:

php artisan make:queue-failed-table
php artisan migrate

The commands you will use in production:

# List failed jobs: ID, connection, queue, failure time
php artisan queue:failed

# Retry one job, several, a whole queue, or everything
php artisan queue:retry ce7bb17c-cdd8-41f0-a8ec-7b4fef4e5ece
php artisan queue:retry --queue=emails
php artisan queue:retry all

# Delete one failed job, or all of them
php artisan queue:forget 91401d2c-0784-4f43-824c-34f94a33c24d
php artisan queue:flush

# Prune failed job records older than 48 hours
php artisan queue:prune-failed --hours=48

queue:prune-failed without --hours removes records older than 24 hours. Schedule it, or the table grows forever, but keep the window long enough for someone to actually read it.

The table is a record, not an alert. Nobody gets told that a row was inserted, which is why the next two hooks exist.

React to a failure in the job itself

A job class can define a failed() method, called when the job fails for good:

use Throwable;

public function failed(?Throwable $exception): void
{
    // Tell the customer, release a reservation, flag the order...
}

Laravel builds a fresh instance of the job before calling failed(), so properties changed inside handle() are lost. $exception is the exception thrown on the last attempt. It is an Illuminate\Queue\MaxAttemptsExceededException only when the job reached its maximum attempts without throwing on that attempt (it was released, or picked up again after retry_after), and a TimeoutExceededException when it timed out.

React to every failure in one place

To be told about any failed job, listen once in the boot method of AppServiceProvider:

use Illuminate\Queue\Events\JobFailed;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Queue;

public function boot(): void
{
    Queue::failing(function (JobFailed $event) {
        Log::error('Queue job failed', [
            'job' => $event->job->resolveName(),
            'connection' => $event->connectionName,
            'exception' => $event->exception->getMessage(),
        ]);
    });
}

Each attempt that throws also goes through your exception handler, so an exception tracker sees the error from the first attempt, not only when the job finally lands in failed_jobs. See the 500 error guide for how reported exceptions reach you, and Laravel logging in production for where those log lines should go.

Attempts, backoff and timeouts

Most "mysterious" queue behaviour comes from these four settings working against each other.

  • Attempts: $tries on the job, or --tries on the worker. The job's value wins. --tries=0 retries forever.
  • Backoff: $backoff (or a backoff() method returning [1, 5, 10]) sets the wait between attempts.
  • Timeout: $timeout on the job, or --timeout on the worker, kills a job that runs too long. Timeouts need the pcntl PHP extension. By default a timeout consumes one attempt and releases the job; $failOnTimeout = true fails it at once.
  • retry_after: set per connection in config/queue.php, it is how long the connection waits before handing a job that is still "in progress" to another worker.

The rule the documentation insists on: the timeout must be several seconds shorter than retry_after. Otherwise a slow job is handed to a second worker while the first is still running it, and the job runs twice. A duplicate charge or a duplicate email usually traces back to this.

class GenerateInvoicePdf implements ShouldQueue
{
    use Queueable;

    public $tries = 3;

    public $backoff = [10, 60];

    public $timeout = 120; // retry_after on this connection must be above 120

    public $maxExceptions = 2;
}

Laravel 13 also accepts these settings as attributes on the class, from Illuminate\Queue\Attributes: #[Tries(3)], #[Backoff([10, 60])], #[Timeout(120)], #[MaxExceptions(2)].

$maxExceptions fails the job after that many unhandled exceptions even when $tries would allow more attempts, which is useful when a job releases itself on rate limits but should still give up on real errors.

Workers: keep them alive

queue:work is a long-running process. It does not restart itself after a crash, a reboot or an out-of-memory kill. In production, a process monitor keeps it running. The Supervisor configuration from the Laravel documentation:

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/forge/app.com/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=forge
numprocs=8
redirect_stderr=true
stdout_logfile=/home/forge/app.com/worker.log
stopwaitsecs=3600

stopwaitsecs must be longer than your longest job, or Supervisor kills it mid-run. --max-time=3600 makes each worker exit after an hour so memory leaks never accumulate; Supervisor starts a fresh one.

Workers keep the code they booted with. Your deploy script must run php artisan queue:restart, which tells every worker to exit after its current job. That command relies on the cache to store the restart signal, and it only works because Supervisor brings the workers back. Without a process monitor, queue:restart stops your queue for good.

Why a dead worker is invisible

This is the failure that costs the most, because nothing reports it.

  • Supervisor was not reinstalled after a server migration.
  • A worker was killed by the kernel for memory and the program was not set to autorestart.
  • A worker is stuck on a frozen job with no timeout.
  • Someone ran horizon:pause during an incident and never resumed.
  • The application stayed in maintenance mode after a failed deploy: workers stop processing jobs unless they run with --force.

In every case, no job runs, so no job throws, so your exception tracker stays perfectly quiet. The failed_jobs table stays empty, which looks like good news. Error monitoring can only report code that executes.

The only reliable way to detect absence is the inverse logic: the worker announces "I am alive" at a regular interval, and something outside your server raises an alert when the announcements stop. That is a heartbeat, or dead man's switch. The same principle applies to the scheduler, covered in the scheduler monitoring guide.

Backlog and wait time

A queue can be alive and still be failing your users: workers process jobs, just not fast enough. Laravel ships a command for this:

php artisan queue:monitor redis:default,redis:deployments --max=100

When a queue holds more jobs than --max, Laravel dispatches an Illuminate\Queue\Events\QueueBusy event. Scheduling the command is not enough on its own: you must listen for the event and decide what to do.

// routes/console.php
use Illuminate\Support\Facades\Schedule;

Schedule::command('queue:monitor redis:default --max=100')->everyMinute();
// AppServiceProvider::boot()
use Illuminate\Queue\Events\QueueBusy;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Log;

Event::listen(function (QueueBusy $event) {
    Log::critical('Queue is backing up', [
        'connection' => $event->connection,
        'queue' => $event->queue,
        'size' => $event->size,
    ]);
});

Note the dependency: queue:monitor runs from the scheduler, so if the scheduler is down, this check is down too.

Size is a proxy. What users feel is wait time: how long a job sits in the queue before a worker takes it. A queue of 500 small jobs may clear in seconds while 20 large exports wait an hour.

Horizon

If your queues run on Redis, Laravel Horizon replaces hand-written Supervisor programs with a code-driven configuration (config/horizon.php) and adds a dashboard with throughput, runtime, failed jobs and wait times. Horizon requires Redis and is not compatible with Redis Cluster.

What it gives you for monitoring:

  • Long wait notifications. Horizon::routeMailNotificationsTo(), routeSlackNotificationsTo() or routeSmsNotificationsTo() in HorizonServiceProvider, with thresholds per connection:queue in the waits option (60 seconds when undefined, 0 disables it).
  • Metrics. Populated by Schedule::command('horizon:snapshot')->everyFiveMinutes();, so again dependent on the scheduler.
  • Process control. horizon:status, horizon:pause, horizon:continue, horizon:terminate (run the last one on deploy). Horizon itself still needs Supervisor.

Horizon reports on what a running Horizon observes. Its notifications are about wait times: if the horizon process itself is down, nothing processes the queue and nothing inside Horizon is left running to tell you. php artisan horizon:status answers the question when someone thinks to ask it.

A practical checklist

  1. Exceptions from jobs reach an error tracker, not only storage/logs.
  2. Queue::failing or a failed() method on the jobs that matter.
  3. queue:prune-failed scheduled with a window someone actually reviews.
  4. Every job's timeout shorter than its connection's retry_after.
  5. Workers under Supervisor (or Horizon under Supervisor), queue:restart or horizon:terminate in the deploy.
  6. A backlog or wait time check with a listener that alerts.
  7. A heartbeat per queue, checked from outside the server.

Official references: Queues and Horizon.

With Quiet Guard

Quiet Guard covers the first and the last items without extra code. Exceptions thrown by jobs are grouped into issues with their stack trace (exception tracking). Since version 0.4 of the SDK, every queue:work worker, Horizon included, pings a queue-{connection}-{queue} heartbeat on each turn of its loop, at most once a minute. When a queue goes silent past its grace (nine minutes by default), every member gets one alert per outage in the dashboard bell, and so does every channel you add on the project's Alerts tab: email on every plan, Slack, Discord, Teams or webhook on Solo, Indie and Studio (alerts). The Heartbeats tab also shows the queue lag measured by the workers, from Laravel 12.11. Heartbeats are included on every plan.

composer require quiet-guard/laravel-monitor
MONITOR_KEY=your-project-api-key
# Optional: choose the queues, production only by default
MONITOR_QUEUE_HEARTBEATS=redis:default,redis:emails

The known cases of false "overdue" (a paused worker, a job longer than the grace, queue:listen) are listed in the heartbeats documentation. Overview: cron and queue monitoring.

The UptimeRobot and Better Stack comparison pages put heartbeats side by side, with their sources.

In Quiet Guard

Cron job monitoring

A task that fails raises an error. A task that stops running raises nothing. Quiet Guard tells you when one stops checking in.

Exception tracking

Every exception your Laravel applications throw, grouped by cause rather than by occurrence, with the full stack trace and the commit that introduced it.

Alerts and notifications

An alert when an issue appears or comes back, when the site goes down, when a task stops pinging or a certificate nears expiry. By email, Slack, Discord, Teams or webhook, and in the dashboard.