# Job has been attempted too many times

A worker picked up a job that had used all its tries, often because an earlier attempt was cut off. Keep retry_after longer than your longest job.

Message:

```text
App\Jobs\SlowJob has been attempted too many times.
```

Exception:

```text
Illuminate\Queue\MaxAttemptsExceededException
```

## What it means

A queue worker reserved a job, saw that its attempts already exceeded the allowed tries, and failed it without running it. The job moves to the `failed_jobs` table with a `MaxAttemptsExceededException`. The job's own code often threw nothing: an earlier attempt ended without the worker recording a result, and the queue handed the job out again.

## Why it happens

- `retry_after` is shorter than the job. The Laravel docs define `retry_after`, set per connection in `config/queue.php` (90 by default), as how long the queue waits before retrying a job that is still being processed. Run a job of 8 seconds with `retry_after` at 4 and two workers, and the second worker reserves the job after 4 seconds. With the default `--tries=1` it fails the job at once while the first worker finishes it, so the job both ran and sits in `failed_jobs`. With more tries, the second worker runs the job a second time while the first still runs it.
- The worker died mid-job. A deploy that kills workers, the out-of-memory killer, a reboot or a `kill -9` leaves the job reserved with its attempt counted. Once `retry_after` passes, the next worker reserves it again; with `--tries=1` that second attempt fails right away.
- The worker timeout could not stop the job first. When a job runs past `--timeout` (60 seconds by default) the worker exits, and on the last try the job fails with `TimeoutExceededException` and the message `App\Jobs\SlowJob has timed out.` instead. That depends on the PCNTL extension, and on `--timeout` being shorter than `retry_after`. The docs ask for it to be at least several seconds shorter; if it is longer, a job can be processed twice.

## How to fix it

Set `retry_after` above the longest time a job may take, and the worker timeout a few seconds below it. This excerpt shows the one key to change in your connection in `config/queue.php`:

```php
'database' => [
    // ...
    'retry_after' => 330,
],
```

```bash
php artisan queue:work --timeout=300
```

A slow job can declare its own timeout, which takes precedence over `--timeout` and must also stay below `retry_after`:

```php
<?php

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Queue\Attributes\Timeout;

#[Timeout(300)]
class ExportOrders implements ShouldQueue
{
    use Queueable;

    // ...
}
```

Stop workers gracefully. `php artisan queue:restart` in your deploy lets each worker finish its current job before it exits. Under Supervisor, set `stopwaitsecs` higher than your longest job, as the docs advise, or Supervisor kills the job mid-run.

Since an attempt can be cut off and the job handed out again, write jobs so that running one twice does no harm.

To see the failed job and retry it:

```bash
php artisan queue:failed
php artisan queue:retry ce7bb17c-cdd8-41f0-a8ec-7b4fef4e5ece
php artisan queue:retry all
```

`queue:forget` with an id deletes one failed job, and `queue:flush` deletes them all.

## Find it in production

No visitor sees this error; the work does not happen. The worker prints `FAIL` next to the job, the `failed_jobs` table holds the exception, and Laravel reports it, so it appears in `storage/logs/laravel.log` and [Ranetrace error monitoring](/features/error-monitoring) records it with the stack trace. A job that fails with `TimeoutExceededException` is different. The worker exits without reporting it, so it reaches neither `laravel.log` nor any error monitoring. It is only in `failed_jobs`, so check `php artisan queue:failed` as well.

Reproduced on PHP 8.5, Laravel 13.45, 5 December 2026.

Read more: https://laravel.com/docs/queues

## Related

### Terms

- [Queues in Laravel](https://ranetrace.com/glossary/queues-in-laravel.md)
- [Jobs in Laravel](https://ranetrace.com/glossary/jobs-in-laravel.md)

### Other errors

- [Maximum execution time exceeded](https://ranetrace.com/error-guides/php-maximum-execution-time-exceeded.md)
- [No query results for model](https://ranetrace.com/error-guides/laravel-no-query-results-for-model.md)

Read this guide in a browser: https://ranetrace.com/error-guides/laravel-job-attempted-too-many-times
