A failed job is a promise your app quietly broke. Something was supposed to happen out of band (an email, a charge, an export, an index update) and it didn't, and because it was already off the request path nobody was watching when it went wrong. The job lands in a table and sits there, and the gap between "a job failed" and "someone noticed" is however long it takes for the missing side effect to become a complaint. Monitoring failed jobs is about shrinking that gap, and about telling the difference between one flaky job and a job class that's quietly falling apart.
Layer 1: The failed_jobs table
Laravel stores failed jobs in the failed_jobs table by default. queue:failed lists every one of them:
php artisan queue:failed
# lists all failed jobs with UUID, connection, queue, class, failed_at
php artisan queue:retry all
# retries every failed job
php artisan queue:retry 5c1d1234-...
# retries a specific job by UUID
php artisan queue:flush
# deletes all failed job recordsThis is fine for small apps. Once you're past a few failures per day, eyeballing the list stops working. You need aggregation.
Layer 2: Event listeners for alerts
Laravel fires Illuminate\Queue\Events\JobFailed when a job exhausts retries. Laravel 11 and 12 apps don't ship an EventServiceProvider, so listen in AppServiceProvider::boot():
app/Providers/AppServiceProvider.php
use Illuminate\Queue\Events\JobFailed;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Log;
public function boot(): void
{
Event::listen(function (JobFailed $event) {
Log::channel('slack')->error('Job failed', [
'job' => $event->job->resolveName(),
'queue' => $event->job->getQueue(),
'exception' => $event->exception->getMessage(),
'attempts' => $event->job->attempts(),
]);
});
}
Pair with a Slack log channel in config/logging.php. You get a ping on every failure. Good enough for low-volume apps; noisy for anything bigger.
Layer 3: Per-class failed() handler
For class-specific cleanup or alerts, Laravel calls a failed() method on the job if present:
app/Jobs/SendWelcomeEmail.php
public function failed(?Throwable $exception): void
{
// Mark the user as needing manual outreach
$this->user->update(['onboarding_failed_at' => now()]);
// Alert the customer success team
CustomerSuccess::notify(new OnboardingEmailFailed($this->user, $exception));
}Useful for side effects (cleanup, customer support notifications). Don't use it for monitoring. You'd be duplicating logic across every job class.
Layer 4: Aggregated failure rate per class
The real signal is failure rate trending, not individual failures. A job class that goes from 0.1% failure rate to 5% is in trouble, even if individual failures look routine.
Metrics to surface per job class:
- Total attempts (count)
- Success / released / failed breakdown
- p50, p95, p99 duration
- Failure rate over time (spike detection)
- Most common exception fingerprint per class
Horizon covers part of this for Redis queues: throughput, average runtime and the failed-job list, with no percentiles or exception fingerprints. For percentiles, grouped exceptions and queue drivers other than Redis (database, SQS, Beanstalkd) you need an APM. NightOwl records every job attempt with class, duration, status, and exception, grouped by class for aggregate trends. It doesn't alert on failure rates: its job alerts fire when a job throws a new exception or a run crosses its duration threshold, so a per-class rate alert needs a scheduled check of your own.
Common failure patterns worth catching
- External API timeouts: wrap HTTP calls in
Http::timeout(); retry with backoff rather than letting the whole job fail. - Database deadlocks: retry the transaction; don't count deadlocks as real failures.
- Missing models: the Eloquent model passed to the job was deleted before a worker picked it up, so restoring it throws
ModelNotFoundException. Setpublic $deleteWhenMissingModels = true;on jobs where that is expected. - Memory exhaustion: jobs processing large collections should chunk with
chunkById(). Tune worker--memoryflag. - Stale code on long-running workers: always
queue:restarton deploy.