Laravel errors, explained and fixed
Errors that break a request or stop a deploy, each one traced to what the framework was doing when it complained.
419 | Page ExpiredLaravel: 419 Page Expired
A 419 is not a bug in your form. It is the CSRF middleware reporting that the session it expected to find was not there, and the reason is almost never the token itself.
SQLSTATE[HY000] [1045] Access denied for userLaravel: SQLSTATE[HY000] [1045] Access denied for user
MySQL rejected the credentials. The password is usually correct - what is wrong is which host the user is allowed to connect from, or which .env the application actually read.
Add [role] to fillable property to allow mass assignment on [App\Models\User].Laravel: Add [field] to fillable to allow mass assignment
The MassAssignmentException is a security guard, not an obstacle. What it is protecting you from, the right fix, and why $guarded = [] is the wrong one.
Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)Laravel: Allowed memory size exhausted
Raising the memory limit makes the error go away until the table grows. The code that needs it is almost always loading a whole result set into models when it could have streamed it.
Attempt to read property "name" on nullLaravel: Attempt to read property on null
PHP 8 turned a notice into a warning and a great deal of code into visible breakage. The message names the property, not the reason it is missing, and the reason is what you need.
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'shop.orders' doesn't existLaravel: SQLSTATE[42S02] Base table or view not found
The query is valid and the table is not there. Where that happens tells you which of the five causes you have, and only one of them is a missing migration.
PDOException: could not find driverLaravel: PDOException could not find driver
PHP has no PDO driver for the database you configured. It is an extension that is missing, disabled or installed for a different PHP binary than the one running your code.
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint failsLaravel: SQLSTATE[23000] Integrity constraint violation
The database refused a write because it would have left a row pointing at nothing. Which of the four 23000 errors you have is written in the number after it, and each one means something different.
Attempted to lazy load [customer] on model [App\Models\Order] but lazy loading is disabled.Laravel: Attempted to lazy load a relation
What the LazyLoadingViolationException is actually telling you, why it is a feature rather than a bug, and the three fixes - only one of which is usually right.
No application encryption key has been specified.Laravel: No application encryption key has been specified
The APP_KEY is missing, unreadable or not the one that encrypted your data. Generating a new one clears the error and can destroy every encrypted value you already hold.
Route [login] not defined.Laravel: Route [login] not defined
An unauthenticated request reached a guarded route, and the framework tried to redirect to a named route your application does not have. The error is about the redirect, not about authentication.
Serialization of 'Closure' is not allowedLaravel: Serialization of 'Closure' is not allowed
The queue writes your job to a row or a Redis key before a worker reads it back. A closure cannot survive that trip, and the exception names the closure rather than the property holding it.
Target class [PostController] does not exist.Laravel: Target class [Controller] does not exist
A BindingResolutionException naming a controller means the container built a class from a string and found nothing there. Four ways to arrive at it, with four different fixes.
SQLSTATE[HY000] [1040] Too many connectionsLaravel: SQLSTATE[HY000] [1040] Too many connections
The database refused a new connection because its limit is reached. The cause is almost never traffic - it is workers, long-running processes or a pool that nobody counted.
Unable to locate file in Vite manifest: resources/js/app.jsLaravel: Unable to locate file in Vite manifest
The @vite directive looked up an entry point in the build manifest and did not find it. Which of the four causes you have depends on whether the manifest exists at all.
Why these pages exist
Search any Laravel exception and the first answer is usually a snippet that silences it. Occasionally that snippet is correct. More often it relocates the fault to somewhere the error handler no longer looks, and it comes back in a month under a different name.
So each page starts with the mechanism - what the framework was doing at the moment it threw - and only then gives the fix. After that come the answers that circulate widely and make things worse.
Everything listed here came out of an audit. These are faults found in production code belonging to real companies, most of them more than once.
Tell us what you are building.
A repository, a slow query log, or three sentences about what keeps breaking. What comes back is an engineer's opinion, not a brochure.
