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

alex29's avatar

MaxAttemptsExceededException: Job has been attempted too many times or run too long. The job may have previously timed out.

I'm getting this error when trying to run a queued job. The job handles video uploads to an S3 bucket. However, I have already tried setting the timeout property on the job class to 3600 seconds just to be sure. But it still times out even before 3600 seconds have passed. What would be other possible causes for this?

Illuminate\Queue\MaxAttemptsExceededException: App\Jobs\UploadToS3 has been attempted too many times or run too long. The job may have previously timed out.
0 likes
6 replies
Nakov's avatar

@alex29 but have you restarted the Queue after you changed the job timeout? Maybe it remembers the old value.

You can also set a timeout when you run the queue, using this:

php artisan queue:work --timeout=60

60 is seconds just so you know.

4 likes
alex29's avatar

Yes, I have ran sudo supervisorctl reload on my server and it still doesn't work. I might try adjusting my laravel-worker config to include the timeout flag but I wanted to keep it as a class property since I might need to adjust it according to a video file's size.

1 like
lionslair's avatar

I hate this error. Tells you nothing on the cause.

31 likes
laracoder's avatar

I have just came across this issue!

After some Googling, I found out that I didn't specify the timeout for Horizon in its config file(config/horizon.php)

'environments' => [
        'production' => [
            'supervisor' => [
                'connection' => 'redis',
                'queue' => ['default'],
                'balance' => 'simple',
                'processes' => 10,
                'tries' => 1,
                'timeout' => 60 * 60 // <<<<<<<< THIS - timeout in seconds
            ],
        ],

        ....
    ],

That's of course if you are using Horizon.

Hope it could help someone!

18 likes
Juampa79's avatar

Perfect @laracoder , that way it worked for me. I had the timeout set in several places, for example in the "supervisor" service, directly in the configuration file, but same error....

So, i configure directly in configuration file of queues in Laravel ; I leave the code behing, thanks!

    'database' => [
        'driver' => 'database',
        'table' => 'jobs',
        'queue' => 'default',
        'retry_after' => 90,
        'after_commit' => false,
        'timeout' => 180
    ],
5 likes

Please or to participate in this conversation.