// guides · n8n error index

n8n “Credentials could not be decrypted” and other credential errors: 13 tests, fixed

Why n8n says “Credentials could not be decrypted” or “Mismatching encryption keys” after a Docker update or a server move, how to get your credentials back, and what 401, 403 and “Credentials not found” really mean. From 13 real runs on n8n 2.43.7.

Updated 2026-10-19 · about 10 minutes

Still stuck after these steps? Paste your exact n8n error and we'll reproduce it and email you the fix, free →

Steps

  1. Find which key n8n is using

    Every self-hosted n8n encrypts saved credentials with one key. On first start it creates it and writes it to ~/.n8n/config as "encryptionKey" (in the official Docker image that folder is /home/node/.n8n). You can also set it yourself with the N8N_ENCRYPTION_KEY environment variable. Before you change anything, copy that config file somewhere safe: without the old key, the old credentials can't be read.

  2. Fix “Mismatching encryption keys”

    n8n refuses to start when the key in the config file and N8N_ENCRYPTION_KEY are different. In our test it stopped at once with Mismatching encryption keys. The encryption key in the settings file /…/.n8n/config does not match the N8N_ENCRYPTION_KEY env var. Nothing is broken yet. Put the same value in both places, using the key your credentials were saved with (usually the one in the config file), or remove the env var.

  3. Fix “Credentials could not be decrypted”

    This one means the key changed after the credentials were saved. We reproduced the classic Docker case: we kept the database but lost the config file, as happens when only the database is on a volume or the container is recreated. n8n started fine, printed No encryption key found - Auto-generating and saving to: …/config, and every workflow using a credential then failed with Credentials could not be decrypted. The likely reason is that a different "encryptionKey" was used to encrypt the data. The fix is to bring the old key back: we removed the new config file and started n8n with N8N_ENCRYPTION_KEY set to the old key, and the same workflow ran again and n8n wrote that key into a new config file. If the old key is really gone, the saved secrets can't be recovered; create the credentials again.

  4. Move credentials to a new server the right way

    n8n export:credentials --all --output=creds.json exports credentials still encrypted with the old key. Imported into a new n8n with its own key, they failed with the same “could not be decrypted” error. Two ways worked: give the new n8n the same N8N_ENCRYPTION_KEY before importing, or export with --decrypted and import that file with n8n import:credentials --input=creds.json. The decrypted file holds your API keys and passwords in plain text, so delete it as soon as the import is done. In Docker, run the same commands inside the container.

  5. Tell key problems apart from a wrong or missing credential

    If n8n can read the credential but the service says no, you get a different message. In our tests a wrong API key (HTTP 403) gave Forbidden - perhaps check your credentials?, and no key at all (HTTP 401) gave Authorization failed - please check your credentials. n8n picks these words from the status code alone, so check the key's value, header name and expiry, not the encryption key. A node set to use a credential type with none selected failed with Credentials not found.

What we tested, and what happened

On 19 October 2026 we ran 13 tests on self-hosted n8n 2.43.7 with the n8n command line (import, export and execute), each in its own n8n folder. The workflows used an HTTP Request node (version 4.2) with a Header Auth credential, calling a small local API that answers 200 for the right key, 403 for a wrong key and 401 when the key is missing.

SetupWhat happened
Right API keySuccess, the API answered.
Wrong API key (403)Forbidden - perhaps check your credentials?
No credential, no auth (401)Authorization failed - please check your credentials
Auth type chosen, no credential selectedCredentials not found
Workflow pointing to a credential that doesn't existImported without any warning. Running it from the command line failed before starting with only No active execution found.
Workflow JSON with the credential name but no idOn import, n8n linked it to the existing credential with that name; it ran fine.
Workflow imported on a new n8n without its credentialImported without any warning, failed when run (No active execution found from the command line).
N8N_ENCRYPTION_KEY different from the config filen8n would not start: Mismatching encryption keys.
Database kept, config file lostNew key generated without asking, then Credentials could not be decrypted.
Same, old key given back with N8N_ENCRYPTION_KEYWorked again; n8n saved the key into the new config file.
Default export, imported on n8n with another keyCredentials could not be decrypted.
--decrypted export, imported on n8n with another keyWorked.
Default export, imported on n8n with the same keyWorked.

Keep your credentials safe on Docker

Quick checklist

Good to know

What we didn't test

FAQ

Why does n8n say credentials could not be decrypted?

The encryption key n8n is using now is not the one the credentials were saved with. It usually happens after a Docker container is recreated without the .n8n folder on a volume, after a server move, or after importing a default credentials export into another n8n. Start n8n with the old key in N8N_ENCRYPTION_KEY to fix it.

How do I fix Mismatching encryption keys in n8n?

Make the encryptionKey in ~/.n8n/config (in Docker /home/node/.n8n/config) and the N8N_ENCRYPTION_KEY environment variable the same value, using the key your credentials were saved with, or remove the environment variable.

Can I recover n8n credentials without the old encryption key?

No. Without the old key the saved secrets can't be read. Look for an old config file, compose file or backup that has it; otherwise create the credentials again.

How do I move n8n credentials to a new server?

Either set the same N8N_ENCRYPTION_KEY on the new server and import the normal export, or run n8n export:credentials --all --decrypted, import the file on the new server with n8n import:credentials, then delete it because it holds your secrets in plain text.

What does Authorization failed - please check your credentials mean in n8n?

The service answered 401: the request had no valid key or token. n8n read your credential fine, so check the value, the header name and whether the key expired. A wrong key that the service rejects with 403 shows Forbidden - perhaps check your credentials?

Related guides

New guides

Still stuck on your n8n error?

Paste the exact error and say what the workflow should do. We reproduce it on a real n8n install and email you the fix or a working workflow, usually within 24h. Free while we're in beta.

We'll only email you about your error and TaskToAgent.