The form redirects back but no error messages appear in the Blade view
The form reloads with old input but no error textShort answer
Laravel flashes validation errors to the session and shares them as $errors through the web middleware group. If the route is outside that group, the redirect was built by hand without withErrors, the page reads a different error bag, or the form was sent by XHR, the view shows nothing. Check each in that order.
Fix it fast
1Find out which cause you have
Put this line in the view that should show the errors. It prints the messages Laravel actually has.
{{ json_encode($errors->all()) }}2Match what you see, then jump to its fix
- 1
The first-step line prints [] or the view fails with an undefined $errorsThe route is outside the web middleware groupFix - 2
You call Validator::make and redirect yourselfA manual Validator fails without withErrorsFix - 3
withErrors was given a second argument, but the view reads plain $errorsThe errors are in a named bagFix - 4
The browser shows no redirect; the network tab holds a JSON error listThe request was sent by XHR, so Laravel returned JSONFix
- 1
What does the error look like?
The form reloads with old input but no error text$errors->any() is false after a failed validation@error('email') never renders its block
Cause 1 of 4
The route is outside the web middleware group
1Check
The $errors variable is shared by the ShareErrorsFromSession middleware, which is part of the web group. Routes in routes/web.php get that group. The -v option of route:list shows the middleware of each route.
php artisan route:list -v2Fix
Define the route in routes/web.php, which is assigned the web middleware group.
// routes/web.php
Route::post('/contact', [ContactController::class, 'store']);3Verify
Submit the invalid form again and look at the first-step output.
# submit the form in the browserConfirmed by laravel.com
Cause 2 of 4
A manual Validator fails without withErrors
1Check
Only the built-in validate() call redirects and flashes automatically. With a manual validator, you must pass the errors to the redirect.
grep -rn "Validator::make" app/2Fix
Chain withErrors and withInput on the redirect.
if ($validator->fails()) {
return redirect('/post/create')
->withErrors($validator)
->withInput();
}3Verify
Submit invalid data. The first-step line now lists the messages.
# submit the form in the browserConfirmed by laravel.com
Cause 3 of 4
The errors are in a named bag
1Check
A name as second argument stores the messages in a separate bag. The default $errors->any() then reports nothing.
grep -rn "withErrors(" app/2Fix
Read the same bag name in the view, or drop the name.
{{ $errors->login->first('email') }}
@error('email', 'login')
<div class="alert alert-danger">{{ $message }}</div>
@enderror3Verify
The message for the named form is visible.
# reload the page after a failed submitConfirmed by laravel.com
Cause 4 of 4
The request was sent by XHR, so Laravel returned JSON
1Check
For XHR requests Laravel returns a JSON response with the messages instead of redirecting.
# browser dev tools, Network tab: look at the response body of the POST2Fix
Read the messages from the JSON response in your script, or submit the form normally.
// the response body holds the validation messages as JSON3Verify
The script shows the messages from the response.
# reload and resubmitConfirmed by laravel.com
How do I stop it coming back?
- Keep every browser form route in routes/web.php.
- Use @error next to each field so a missing message is easy to spot.
- Name an error bag only when one page holds several forms.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Composer says the gd extension is missing on a Laravel project
composer install or composer update stops on a package that requires ext-gd
Composer refuses to install a package that requires ext-gd when the PHP binary running Composer has no GD extension.
4 causes, each with a fixBack end
composer require maatwebsite/excel fails to install
Composer says the package needs an older PHP than the one installed
Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.
3 causes, each with a fixBack end
composer install says the lock file is not compatible and asks for update
Your lock file does not contain a compatible set of packages. Please run composer update.
composer install checked the locked packages against this machine's PHP and extensions and found a conflict.
3 causes, each with a fixBack end
composer require laravel/horizon fails: ext-pcntl is missing
laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system
Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.
3 causes, each with a fixBack end
composer require laravel/passport stops with 'requirements could not be resolved'
... but these were not loaded, likely because it conflicts with another require.
Composer found no Passport release that fits your project at once.
4 causes, each with a fixBack end
Composer says the root composer.json requires a PHP version your PHP does not satisfy
Your requirements could not be resolved to an installable set of packages.
Composer compares the php constraint in your composer.json, or in a package, with the PHP that runs Composer.
3 causes, each with a fix