Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

308
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

0

Change uuid field nullable at failed_jobs table.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda