Error message
Laravel: 419 Page Expired, CSRF token mismatch
Laravel answers a form submission with a 419 “Page Expired” page, or {"message": "CSRF token mismatch."} for an API call. Nobody gets an alert: Laravel does not report this exception, so sentry/sentry-laravel never sees it. That is deliberate, and you can change it with one line.
Examples run on 21 November 2026 with Laravel 13.43.0, PHP 8.6.0 and sentry/sentry-laravel 4.22.0, 4.26.0 and 4.31.0. Errilo is in private beta.
What the message says
In Laravel 13.43.0, the PreventRequestForgery middleware checks every POST, PUT, PATCH and DELETE request of the web group (it was called VerifyCsrfToken before Laravel 13). When it can’t validate the request, it throws Illuminate\Session\TokenMismatchException (CSRF token mismatch.), which Laravel turns into an HTTP error 419. A form and its route:
Route::get('/form', fn () => '<form method="POST" action="/form">
<input type="hidden" name="_token" value="'.csrf_token().'"><button>Save</button></form>');
Route::post('/form', fn () => 'saved');A POST without token, with APP_DEBUG=false:
$ curl -s -o /dev/null -w "HTTP %{http_code}
" -X POST http://127.0.0.1:8000/form
HTTP 419 (HTML page titled "Page Expired")
$ curl -H 'Accept: application/json' -X POST http://127.0.0.1:8000/form
{"message": "CSRF token mismatch."} (HTTP 419)The middleware lets the request through when one of these holds, read in its source and run:
- The token sent in the
_tokenfield, or in anX-CSRF-TOKENorX-XSRF-TOKENheader, equals the one in the session. A form with its token and the session cookie gotsaved. - The request has a
Sec-Fetch-Site: same-originheader. In Laravel 13.43.0, aPOSTwith that header and no token, no session at all, got a 200. Withsame-site,cross-siteor no header, 419. Browsers send that header themselves; we only sent it with curl, not from a browser.
Causes and fixes
- No token in the request: a form without
@csrf, or an API client, Postman or a script that doesn’t send the header. Add the token, or move the route out of thewebgroup if it is a real API with its own authentication. - The session no longer exists: the user waited longer than the session lifetime (
SESSION_LIFETIME, 120 minutes in the skeleton), or the session store was emptied by a deploy or a cleanup. We deleted the session file between the form and thePOST: 419, though the token in the form was the right one. Reload the page to get a new token. - The session cookie doesn’t come back: another domain, a
Securecookie on plain HTTP, aSameSitesetting that blocks it in an embedded page, a CDN that caches a page with its token. We did not reproduce these cases; check the cookie in the browser’s network tab. - A webhook from another service can’t have a token: exclude its route with
$middleware->preventRequestForgery(except: ['stripe/*'])inbootstrap/app.php, and verify its signature instead.
For fetch and Ajax, send the token in the header:
<meta name="csrf-token" content="{{ csrf_token() }}">
<script>
fetch('/form', {
method: 'POST',
headers: { 'X-CSRF-TOKEN': document.querySelector('meta[name=csrf-token]').content },
});
</script>Why Sentry does not report it
Integration::handles($exceptions) registers a reportable callback on Laravel’s exception handler, and Laravel only calls those for exceptions it would report. Its list of internal exceptions that are never reported ($internalDontReport in Handler.php) includes TokenMismatchException, and also HttpException (every 4xx), AuthenticationException, ValidationException and ModelNotFoundException.
We checked it with the three versions of sentry/sentry-laravel. In one run, a route that threw Class "…" not found returned 500 and arrived in the fake ingest; a POST without token returned 419 and nothing arrived. So the 419s your users see are invisible to an error tracker, unless you ask for them:
use Illuminate\Session\TokenMismatchException;
use Sentry\Laravel\Integration;
->withExceptions(function (Exceptions $exceptions) {
Integration::handles($exceptions);
$exceptions->stopIgnoring(TokenMismatchException::class);
})- With
stopIgnoring(), the event arrives in all three versions: typeIlluminate\Session\TokenMismatchException, valueCSRF token mismatch., the request (POSTand URL), unhandled, no level, about fifty frames, almost all of them Laravel’s. - Think before turning it on: every expired session and every bot that posts to a form becomes an event. Most teams only want it to see a spike, for instance after a deploy that changed the session driver or
APP_KEY.
The setup is in the Laravel guide. Symfony has its own CSRF component; we did not test it, see the Symfony guide for the setup.
How Errilo shows it
Once you report it, the issue is titled Illuminate\Session\TokenMismatchException: CSRF token mismatch., with an Unhandled badge and level Error (the event has none, and Errilo reads that as an error). Its location is require_once in public/index.php: the failure happens in a middleware of the framework, before any of your code, so the top frame of your own code is the entry point.
Errilo groups on the type and the frames. In our test, the same failure on POST /form and POST /other had the same fingerprint: one issue for every 419 in the application. The request of each event tells the routes apart. Without stopIgnoring(), Errilo shows nothing, because the SDK sends nothing: Errilo has no filter to apply and no event to filter.