Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

300
Views
Laravel Supervisor: Duplicate entry '' for key 'failed_jobs_uuid_unique'

I'm using Laravel's Supervisor for queue management, and added the failed_jobs table by using the default commands (php artisan queue:failed-table + migrate).

A job sometimes fails, but the failed_jobs table is never filled because it apparently tries to add a record without a primary key. I have no idea where in Laravel to have it generate a uuid.

I find issues like Duplicate entry '014c3080-3ee3-4198-946c-dfe1d8d858a7' for key 'failed_jobs_uuid_unique', but that has a different cause. My application doesn't even generate a uuid.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

It seems like Laravel is trying to log the same failed job with the same UUID multiple times. This may happen when two workers pick the same job and both executions fail. The first worker will be able to log the job successfully but the second worker will receive this error because an entry with the same UUID already exists.

check this link for prevent this issue

https://divinglaravel.com/prevent-your-queued-jobs-from-duplicating

over 4 years ago · Santiago Trujillo Report

0

The uuid of a Job is generated trough a driver named "database-uuids". This should be configured by default inside your config/queue.php as following (near the end of the file):

'failed' => [
    'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
    'database' => env('DB_CONNECTION', 'mysql'),
    'table' => 'failed_jobs',
],

Unless you have provided another value for QUEUE_FAILED_DRIVER in your .env file, your failed_jobs should be given a uuid by default.

If this does not work, please leave a comment on this answer and I'll try look for another solution.

over 4 years ago · Santiago Trujillo Report

0

Change uuid field nullable at failed_jobs table.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!