People searching “Inertia flash error” put the sentence in with('error') and the toast stays quiet. The flash guide shows the success shape the Vue starter kit already listens for. An error is the same array.
TL;DR
- The kit’s toast reads flash.toast.
- An error uses the same array with type error.
- with() does not reach it.
- Do not flash the exception message.
The fix#
use Inertia\Inertia;
Inertia::flash('toast', [
'type' => 'error',
'message' => 'Could not publish that post.',
]);
return back();type is success, info, warning, or error. The kit’s initializeFlashToast() reads flash.toast. A string on another key never arrives.
Use this for a failure that is not a validation error. A bad title still belongs in form.errors.title from validate(). A toast and a field error for the same mistake makes the user read it twice.
What to avoid#
Gotcha
Do not flash the exception message. It can include SQL or a path. Write a sentence you would say to the person using the page.
FAQ#
How do I flash an error toast in Vue?
The kit's toast reads flash.toast. An error uses the same array with type error. with() does not reach it.
What goes wrong with Inertia flash error?
Many developers put the sentence in with('error') and the toast stays quiet. Do not flash the exception message.



