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 corrupted.
DecryptException: The payload is invalid.The MAC is invalid.Illuminate\Contracts\Encryption\DecryptException The MAC is invalidThe payload is invalid LaravelIlluminate\Encryption\Encrypter DecryptException Meaning
Cookies and encrypted data are signed with APP_KEY. After key regeneration, different keys across servers, or a changed .env/config cache, old cookies fail. Users just need new sessions (clear cookies); for load-balanced setups use the same key everywhere. Stored encrypted DB values become unreadable if the key is lost.
Common causes
- APP_KEY changed or regenerated
- Different APP_KEY across servers
- Config cached with an old key
- Corrupted or truncated cookie
- Encrypted data written under another key
⚡ Quick fix
- Use one persistent
APP_KEYon all servers - Clear the browser cookies / sessions
php artisan config:clear
Detailed fix by platform
Laravel
- Rotate keys safely with
APP_PREVIOUS_KEYS(Laravel 11+) to keep decrypting old data
How to diagnose
- Key — Same on all servers?
- Change — Recently regenerated?
- Cache — Config cleared?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 403 This action is unauthorized Laravel: Illuminate\Auth\Access\AuthorizationException: This action is unauthorized.
- ActiveSupport::MessageEncryptor::InvalidMessage Rails: ActiveSupport::MessageEncryptor::InvalidMessage (credentials.yml.enc can't be decrypted — wrong master.key)
- Attempt to read property "x" on null Laravel/PHP 8: ErrorException: Attempt to read property "name" on null
Most viewed in Laravel
- MassAssignmentException Laravel: Illuminate\Database\Eloquent\MassAssignmentException: Add [x] to fillable property to allow mass assignment
- The GET method is not supported for route Laravel: The GET method is not supported for route x. Supported methods: POST (MethodNotAllowedHttpException)
- Route [login] not defined Laravel: Symfony\Component\Routing\Exception\RouteNotFoundException: Route [login] not defined
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026