Laravel errors

Laravel framework errors — routing, Eloquent, validation, configuration and deployment — with artisan fixes.

CodeErrorWhat it means
The Mix manifest does not exist Laravel Mix: Illuminate\Foundation\Exceptions\... The Mix manifest does not exist. (public/mix-manifest.json) A view calls `mix('css/app.css')`, but the assets were never compiled so `public/mix-manifest.json` is missin…
403 This action is unauthorized Laravel: Illuminate\Auth\Access\AuthorizationException: This action is unauthorized. A policy or gate denied the action for the current user, so Laravel returned HTTP 403.
Attempt to read property "x" on null Laravel/PHP 8: ErrorException: Attempt to read property "name" on null You accessed a property on a value that is `null`, typically an empty relationship or a query that found noth…
Livewire: Unable to find component Laravel Livewire: Livewire\Exceptions\ComponentNotFoundException: Unable to find component: [admin.users] Livewire can't resolve a component alias to a class — wrong name, namespace or discovery.
MassAssignmentException Laravel: Illuminate\Database\Eloquent\MassAssignmentException: Add [x] to fillable property to allow mass assignment You passed an array to create()/update()/fill() containing a field that isn’t in the model’s $fillable list.
Command "x" is not defined Laravel: Symfony\Component\Console\Exception\CommandNotFoundException: Command "make:livewire" is not defined. Did you mean one of these? `php artisan` doesn't know the command you typed — typo, missing package or an unregistered service provider.
SQLSTATE[23000]: Integrity constraint violation Laravel: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'x@example.com' for key 'users_email_unique' The query violated a database constraint — a duplicate value in a unique column or a missing/blocked foreign…
SQLSTATE[HY000] [2002] Connection refused Laravel: SQLSTATE[HY000] [2002] Connection refused (SQL: select * from sessions) / php_network_getaddresses: getaddrinfo failed Laravel can't open a network connection to the database host and port from `.env`.
TypeError: Argument #1 must be of type X, Y given Laravel/PHP: TypeError: App\Services\Mailer::send(): Argument #1 ($user) must be of type App\Models\User, null given A function received a value of the wrong type — often `null` where an object was required.
CORS blocked (Laravel API) Browser: Access to XMLHttpRequest at 'https://api.example.com' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header — Laravel The browser blocked a cross-origin call to your Laravel API because the response lacks the right CORS headers.
Composer: Allowed memory size exhausted Composer: PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer Composer ran out of PHP memory while resolving or installing dependencies.
Foreign key constraint is incorrectly formed Laravel migration: SQLSTATE[HY000]: General error: 1005 Can't create table (errno: 150 "Foreign key constraint is incorrectly formed") MySQL can't create the foreign key because column types, order or engines don't match the referenced table.
No scheduled commands are ready to run Laravel scheduler: INFO No scheduled commands are ready to run. (tasks never execute) `schedule:run` is executing but finds nothing due — or the cron entry that triggers it isn't set up.
Property [x] does not exist on this collection instance Laravel: Exception: Property [name] does not exist on this collection instance. You treated a Collection (many results) as a single model.
Specified key was too long; max key length is 1000 bytes Laravel: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes An indexed string column exceeds the index size allowed by an older MySQL/MariaDB with utf8mb4.
SQLSTATE[HY000] [1045] Access denied for user Laravel: SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: YES) MySQL rejected the username/password configured in Laravel's `.env`.
The GET method is not supported for route Laravel: The GET method is not supported for route x. Supported methods: POST (MethodNotAllowedHttpException) The URL exists, but not for the HTTP method used — e.g. opening a POST-only route in the browser, or a form s…
Undefined array key Laravel/PHP 8: ErrorException: Undefined array key "name" (PHP 8) / Undefined index: name (PHP 7) Code read an array element whose key isn't present.
Laravel: Allowed memory size exhausted (request) Laravel/PHP: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in vendor/laravel/framework A request (or artisan job) used more memory than PHP's `memory_limit` allows.
ModelNotFoundException in queued job Laravel Queue: Illuminate\Queue\SerializesModels: No query results for model [App\Models\Order] 42 (job failed) A queued job serialised a model by ID, but the record was deleted before the worker ran it.
Sail: getaddrinfo failed for host mysql Laravel Sail: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: Temporary failure in name resolution Commands run outside the Sail container (on the host) try to resolve the Docker service name `mysql`, which o…
Storage files 404: public/storage symlink missing Laravel: 404 for /storage/file.jpg — symlink(): No such file or directory / The [public/storage] link already exists Uploaded files stored in `storage/app/public` aren't reachable because the `public/storage` symlink doesn't e…
BadMethodCallException: Call to undefined method Laravel: BadMethodCallException: Call to undefined method App\Models\Post::whereTitle() / Illuminate\Database\Eloquent\Builder::foo() You called a method the model, builder or collection doesn't have.
503 Service Unavailable (maintenance mode stuck) Laravel: Be right back. / 503 Service Unavailable after php artisan down The application is in maintenance mode — after `php artisan down` (or a failed deploy) it was never brought b…
Undefined variable $x (Blade view) Laravel: ErrorException: Undefined variable $posts (View: /resources/views/posts/index.blade.php) A Blade template uses a variable the controller didn't pass to the view.
DecryptException: The payload is invalid / The MAC is invalid Laravel: Illuminate\Contracts\Encryption\DecryptException: The payload is invalid. / The MAC is invalid. Laravel couldn't decrypt a cookie, session or encrypted value — the `APP_KEY` changed or the data was corrupt…
The bootstrap/cache directory must be present and writable Laravel: RuntimeException: The /var/www/bootstrap/cache directory must be present and writable. Laravel can't write its compiled cache files because the folder is missing or has the wrong permissions/owner.
Base table or view already exists Laravel: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists A migration tries to create a table that is already in the database.
SQLSTATE[42S22]: Column not found Laravel: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'status' in 'field list' The SQL refers to a column that doesn't exist in the table — a missing migration, typo or wrong table.
Maximum execution time of 30 seconds exceeded Laravel: Symfony\Component\ErrorHandler\Error\FatalError: Maximum execution time of 30 seconds exceeded A web request ran longer than PHP's `max_execution_time` and was killed.
The process exceeded the timeout of 60 seconds Laravel: Symfony\Component\Process\Exception\ProcessTimedOutException: The process "npm run build" exceeded the timeout of 60 seconds A subprocess launched via the `Process` class or `Process::run()` exceeded its allowed time.
404 on all routes except home (public folder / .htaccess) Laravel on shared hosting: homepage works but every other route returns 404 Not Found The web server isn't sending requests to `public/index.php`, so only the root path works — the rewrite rules…
MaxAttemptsExceededException (queue job) Laravel Queue: Illuminate\Queue\MaxAttemptsExceededException: App\Jobs\SendReport has been attempted too many times or run too long A queued job failed repeatedly or ran past its timeout, so it was marked failed.
Sanctum: 401 Unauthenticated Laravel Sanctum: {"message":"Unauthenticated."} 401 on API / SPA requests A request to a `auth:sanctum` route had no valid token or session, so Laravel returned 401.
env() returns null (config cached) Laravel: .env changes ignored / env('X') returns null after php artisan config:cache After `config:cache`, Laravel no longer reads `.env`, so `env()` calls outside config files return null and e…
PDOException: could not find driver Laravel: Illuminate\Database\QueryException: could not find driver (SQL: select * from information_schema.tables) The PHP PDO extension for your database (pdo_mysql, pdo_pgsql, pdo_sqlite) isn't installed or enabled.
429 Too Many Requests (Laravel throttle) Laravel: Illuminate\Http\Exceptions\ThrottleRequestsException: Too Many Attempts. / 429 Too Many Requests Laravel's rate limiter blocked the client for exceeding the allowed requests per minute.
SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client Laravel: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client [caching_sha2_password] The PHP MySQL driver doesn't support the authentication plugin MySQL 8 uses (`caching_sha2_password`).
Your PHP version does not satisfy requirement Composer/Laravel: Your Composer dependencies require a PHP version ">= 8.2.0". You are running 8.1.12 The installed dependencies need a newer PHP than the one running the app (CLI or web server).
422 Unprocessable Entity: The given data was invalid Laravel: {"message":"The given data was invalid.","errors":{"email":["The email field is required."]}} (422) Request validation failed, so Laravel returned HTTP 422 with the field errors.
cURL error 28: Operation timed out (Laravel HTTP client) Laravel: Illuminate\Http\Client\ConnectionException: cURL error 28: Operation timed out after 30001 milliseconds with 0 bytes received The Laravel `Http::` client waited for a response longer than its timeout and gave up.
Unable to locate a class or view for component Laravel: InvalidArgumentException: Unable to locate a class or view for component [alert]. A `` Blade tag has no matching class or anonymous component view.
Unable to locate factory for model Laravel: InvalidArgumentException: Unable to locate factory with name [default] [App\Models\Post] / Call to undefined method App\Models\Post::factory() A seeder or test calls a model factory that is missing, or the model doesn't use the `HasFactory` trait.
InvalidArgumentException: View [x] not found Laravel: InvalidArgumentException: View [posts.index] not found. Laravel can't find the Blade file for the view name you returned.
Redis connection refused (Laravel) Laravel: Predis\Connection\ConnectionException: Connection refused [tcp://127.0.0.1:6379] / RedisException: Connection refused Laravel can't connect to Redis, which it uses for cache, sessions or queues.
Session store not set on request Laravel: RuntimeException: Session store not set on request Code used `session()` or `$request->session()` in a route/middleware group that doesn't run the session middl…
Unsupported cipher or incorrect key length Laravel: RuntimeException: Unsupported cipher or incorrect key length. Supported ciphers are: aes-128-cbc, aes-256-cbc, aes-128-gcm, aes-256-gcm `APP_KEY` is missing, malformed or empty, or `config/app.php` cipher doesn't match the key length.
Key path oauth-private.key does not exist or is not readable Laravel Passport: LogicException: Key path "file:///var/www/storage/oauth-private.key" does not exist or is not readable Passport can't find or read its OAuth signing keys.
No query results for model Laravel: Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [App\Models\Post] 5 `findOrFail`, `firstOrFail` or route-model binding couldn't find a record, so Laravel returns a 404.
Route [login] not defined Laravel: Symfony\Component\Routing\Exception\RouteNotFoundException: Route [login] not defined Code called route('name') for a route name that doesn’t exist — very often route('login') from the auth middl…
Class "App\Models\X" not found Laravel: Error: Class "App\Models\Post" not found PHP can't find the class you referenced — a missing import, wrong namespace or file name, or a stale autoload…
Unable to prepare route for serialization. Uses Closure Laravel: LogicException: Unable to prepare route [dashboard] for serialization. Uses Closure. `php artisan route:cache` failed because a route uses a closure, which can't be cached.
Token has expired (tymon/jwt-auth) Laravel JWT: Tymon\JWTAuth\Exceptions\TokenExpiredException: Token has expired / The token could not be parsed from the request A JWT sent by the client is expired, invalid or absent, so `jwt-auth` rejects the request.