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

murilo's avatar
Level 10

Laravel is not return validation errors , instead . it is showing 404.

hello , It is happening something very strange here in a laravel project . if has any errors in Request or if I force an errors . It is not showing the errors . instead , it is redirecting to 404 .

this happening after I installed passport -

  • php require laravel/passport
  • php artisan migrate
  • php artisan passport:install --uuids

Version

 "require": {
        "php": "^8.1",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^10.10",
        "laravel/passport": "^11.10",
        "laravel/sanctum": "^3.3",
        "laravel/tinker": "^2.8"
    },

I tried -

php artisan config:cache
php artisan cache:clear
php composer update
php composer dump-autoload
0 likes
3 replies
ramonrietdijk's avatar

I assume the route does actually exists, as it only happens when validation errors occur?

How is the request sent to Laravel? If you're using AJAX, make sure you set the correct headers like Accept and Content-Type.

murilo's avatar
Level 10

I am sending request via postman . any erros returns 404

Snapey's avatar

@murilo Repeat advice above, make sure you sent the correct headers so that Laravel knows you want a json response and to not redirect to a non-existant page

Please or to participate in this conversation.