Why are my Laravel failed jobs not showing up in the failed_jobs table?

Stefan Bogdanescu

Founder & Senior Architect · 2026-06-29

Laravel Company
# Why are my Laravel failed jobs not showing up in the `failed_jobs` table? A Deep Dive into Queue Failures Dealing with asynchronous job processing in Laravel is powerful, but when things go wrong—like a job failing—the debugging process can become frustrating. One common point of confusion developers encounter is the discrepancy between a job failing gracefully (as seen in logs) and that failure not being recorded in the dedicated `failed_jobs` table. If you've followed the standard procedure, created the necessary migrations, and yet your failed jobs are invisible to you, there is almost always a subtle issue lurking in your database schema or configuration. As a senior developer, I’ve seen this exact scenario before. Let’s dissect why this happens and how to ensure your queue failures are properly tracked. ## The Scenario: A Job Fails, But the Record Disappears You have set up your queue system, defined jobs, and successfully forced a job to fail by throwing an exception within the `handle()` method. The logs clearly show the failure being registered in the standard Laravel job history (the `jobs` table), but when you check the dedicated `failed_jobs` table, the record is missing. This situation points away from a bug in Laravel’s queue mechanism itself and squarely toward an issue with the underlying database structure that Laravel relies upon for persistence. ## The Root Cause: Database Schema Mismatch The most critical clue often lies within the error messages generated by the database when Laravel attempts to insert data. In your specific case, the log output provided a massive hint: `General error: 1364 Field 'uuid' doesn't have a default value`. This error signifies that the migration you ran to create the `failed_jobs` table did not correctly define the necessary columns, specifically missing the required `uuid` field or failing to set it up as a proper primary key/default value according to Laravel’s expectations. When Laravel attempts to persist a failed job record into the `failed_jobs` table using Eloquent, it expects certain fields (like the unique identifier for the job) to be present and correctly configured. If the database schema is incomplete or inconsistent with what Laravel expects—especially concerning UUIDs which are heavily used in modern Laravel applications—the insertion fails silently or throws a fatal error that might be missed if not properly handled by your queue worker configuration. ## Solutions: Ensuring Schema Integrity for Queue Failures To resolve this, we need to enforce strict schema integrity before the queue worker attempts to write data. Follow these steps to ensure your failed jobs are reliably recorded. ### 1. Review and Correct Your Migration The solution lies in meticulously reviewing the migration file you used to create the `failed_jobs` table. You must ensure that the columns match what Laravel expects, especially regarding primary keys and UUIDs. Here is a robust example of how a correct failed jobs migration should be structured: ```php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { public function up(): void { Schema::create('failed_jobs', function (Blueprint $table) { $table->id(); // Standard primary key $table->string('uuid')->unique(); // Ensure the UUID field exists and is unique $table->text('payload'); $table->longText('serialized'); $table->text('error'); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('failed_jobs'); } }; ``` **Key Takeaway:** Notice the explicit definition of `uuid()` and ensuring all necessary fields are present. This step is fundamental when setting up any complex persistence layer, aligning with best practices advocated by resources like [laravelcompany.com](https://laravelcompany.com). ### 2. Re-run Migrations Safely After correcting your migration file, you must re-run the migration to update your database schema: ```bash php artisan migrate ``` This ensures that the `failed_jobs` table has all the required columns, including the `uuid`, allowing Laravel’s queue system to successfully insert failed job records. ### 3. Verify Queue Configuration While the schema is the most likely culprit, always double-check your queue configuration. Ensure your queue driver (e.g., database) is correctly configured and that the credentials used by the worker have full write permissions to the target database. A simple permission issue can also manifest as a failed insertion without throwing a clear error in the application logs. ## Conclusion The mystery of missing failed jobs often boils down to a mismatch between the application layer (Laravel) and the persistence layer (Database Schema). By focusing on the migration files and ensuring that every table Laravel relies upon—especially custom tables like `failed_jobs`—has perfectly defined columns, you can eliminate these frustrating inconsistencies. Mastering database schema management is crucial for building robust, reliable applications with Laravel.