Error guides

No query results for model

A findOrFail, firstOrFail or route model binding found no row, and Laravel answered 404. Check the id, soft deletes, scoped bindings and queued jobs.

Message
No query results for model [App\Models\Post] 5
Exception
Illuminate\Database\Eloquent\ModelNotFoundException

What it means

Eloquent ran a query that had to return a model and got nothing back, so it threw Illuminate\Database\Eloquent\ModelNotFoundException. The message names the model and the ids it looked for: findOrFail(5) gives No query results for model [App\Models\Post] 5, while firstOrFail() has no id to name and ends with a full stop instead. In a web request Laravel turns this exception into a 404 response.

Why it happens

  • findOrFail or firstOrFail found no row. The id does not exist, or the where clauses exclude every row.
  • Route model binding got an id that does not exist. For a route like /posts/{post} with a Post $post parameter, the docs say a 404 response is generated when no matching model is found.
  • The model is soft deleted. Implicit binding leaves soft deleted models out, so /posts/3 gives 404 for a trashed post.
  • A scoped binding did not match. With scopeBindings(), /users/1/posts/2 looks for post 2 through the user's posts relationship, and gives 404 when that post belongs to another user.
  • A queued job's model was deleted before the job ran. Laravel stores only the model's id on the queue and fetches the model again when the job runs. If the row is gone, the job fails with No query results for model [App\Models\Post]. A soft deleted model is still fetched, and the job runs.

How to fix it

When a missing row is a normal outcome, use find or first and handle null instead of findOrFail.

To bind trashed models on a route, chain withTrashed:

Route::get('/posts/{post}', function (Post $post) {
    return $post;
})->withTrashed();

For scoped bindings, check that the parent has the relationship Laravel guesses, the plural of the route parameter (posts for {post}), and that the link points at the right parent. To answer a missing model with something other than a 404, use missing:

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;

Route::get('/posts/{post}', function (Post $post) {
    return $post;
})->missing(function (Request $request) {
    return Redirect::to('/posts');
});

For a job whose model may disappear, the docs offer the DeleteWhenMissingModels attribute. The job is then deleted quietly instead of failing:

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

#[DeleteWhenMissingModels]
class PublishPost implements ShouldQueue
{
    use Queueable;
}

Find it in production

A visitor gets a 404 page titled "Not Found". A request that asks for JSON gets {"message": "No query results for model [App\\Models\\Post] 99"} even with APP_DEBUG=false, which tells an API client your model's class name.

Laravel does not report this exception. ModelNotFoundException and its parent RecordsNotFoundException are both on the $internalDontReport list in Illuminate\Foundation\Exceptions\Handler, so nothing reaches storage/logs/laravel.log or an error tracker. Look for 404 responses in your web server's access log instead.

A job that fails this way is not reported at all. Laravel catches the exception while it restores the job's models and fails the job without calling report(), so no setting brings it into a log or an error tracker. It lands only in the failed_jobs table, with the full exception:

php artisan queue:failed

To have Laravel report it in HTTP requests, stop ignoring both classes in bootstrap/app.php. Naming only ModelNotFoundException is not enough, because the parent class still matches:

$exceptions->stopIgnoring([
    \Illuminate\Database\Eloquent\ModelNotFoundException::class,
    \Illuminate\Database\RecordsNotFoundException::class,
]);

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

Start monitoring today

Websites go down and code throws errors. Ranetrace tells you when it happens to yours, why it matters and what to do next.

Start your 30-day free trial From $9 a month. No credit card required.