Error fix

No application encryption key has been specified: Fix

Laravel needs APP_KEY to encrypt cookies, including the session cookie, and other encrypted values. The key is missing or not loaded.

The error message

No application encryption key has been specified.

Possible causes: why does "No application encryption key has been specified." appear?

  • .env missing or APP_KEY empty. The .env file is not committed to source control, so a fresh checkout has none, or APP_KEY in it is empty.
  • Configuration cached without the key. After php artisan config:cache the .env file is no longer loaded. A cache built before the key was set keeps the empty value.

How do you fix it?

  1. If there is no .env, copy it from .env.example.
  2. Run php artisan key:generate.
  3. If the configuration is cached, run php artisan config:clear.
  4. On production, do not simply replace an existing key: all logged-in users are logged out, and data encrypted with the old key can no longer be decrypted. List previous keys in APP_PREVIOUS_KEYS.

Generate the key

cp .env.example .env
php artisan key:generate

Sources

Sources checked on 2026-12-03. German version: No application encryption key has been specified beheben

Related errors

Still getting the error?

Your Laravel project gets checked, and you learn honestly what causes it. Free 30-minute call.