This is a painful situation, and unfortunately you’ve run into one of the most fragile points of n8n’s architecture: the encryption key (N8N_ENCRYPTION_KEY) that’s stored in .n8n/config.
Let me break this down carefully:
1. Why the workflows aren’t appearing
-
n8n stores two kinds of data in the database (database.sqlite):
-
Workflows, executions, and metadata → these are not encrypted.
-
Credentials → these are encrypted using the key from the config file.
-
Normally, if you lose the encryption key, you should still see workflows and executions (but credentials would be broken/unusable).
-
In your case, since you’re seeing the “setup owner” screen, that suggests n8n thinks the DB is brand new. That happens if:
-
The DB schema doesn’t match the current n8n version and migration failed.
-
Or n8n actually created a new DB file instead of using your backup (path or mount issue).
-
Or your DB has the data but the “ownership” row (the user record in user table) is gone or unreadable.
2. What should happen if the encryption key is lost
-
Expected behavior:
-
It is not expected that n8n wipes the whole DB just because the key doesn’t match.
So if you’re not seeing any workflows, that points to something deeper (e.g., n8n ignoring or failing to read the DB file).
3. Recovery options
Since your database file is intact, you still have your workflows. Options:
A. Verify the DB really has your workflows
-
Install SQLite CLI (sqlite3 database.sqlite).
-
Run:
.tables
SELECT id, name FROM workflow_entity;
B. Extract workflows manually
If workflows exist in the DB:
-
Dump them:
SELECT id, name, nodes, connections FROM workflow_entity;
-
Copy these JSONs into files.
-
Import them into a fresh n8n instance via the UI.
This way you bypass the missing encryption key (since workflows aren’t encrypted).
C. Credentials are gone unless…
Credentials are AES-encrypted with the lost key. If the key file is really corrupted/empty and you have no backup, credentials cannot be decrypted. You’ll need to re-enter them manually after importing workflows.
4. Why you’re seeing the “setup” screen
-
That’s tied to the user table (user and settings tables). If those entries are unreadable (e.g., schema mismatch after upgrading), n8n assumes this is a fresh instance.
-
This doesn’t mean workflows are gone — just that n8n isn’t loading them.
5. Practical recovery steps
-
Check DB contents with SQLite manually.
-
Dump workflows to JSON.
-
Re-import into fresh instance.
-
Recreate credentials manually.
-
(Optional) If user table is intact, you can also manually set up the owner account by editing rows, but importing workflows is usually simpler.
Answering your core questions directly:
-
Is it expected that workflows are lost if the key is lost?
No. Only credentials are encrypted. Workflows should still be present.
-
Can you recover workflows from the DB without the key?
Yes. Use SQLite to dump workflows and re-import them.
Credentials cannot be recovered without the key.
-
step by step so you can pull your workflows out of the SQLite database and re-import them into a fresh n8n instance.
1. Install SQLite CLI
If you don’t already have it:
-
On Linux (WSL, or Git Bash if on Windows):
sudo apt-get update && sudo apt-get install sqlite3 -y
-
On Windows: download sqlite-tools, unzip, and put sqlite3.exe in your PATH or same folder as the DB.
2. Open your database
sqlite3 database.sqlite
3. Check tables
Inside SQLite:
.tables
You should see something like:
credentials_entity execution_entity workflow_entity user settings
4. Verify workflows exist
Run:
SELECT id, name FROM workflow_entity;
5. Dump workflows to JSON
Now export all workflows:
.mode json
.output workflows.json
SELECT id, name, nodes, connections FROM workflow_entity;
.output stdout
This will create a workflows.json file in your current folder.
Each row will look like:
{"id":1,"name":"My Workflow","nodes":"[{...}]", "connections":"{...}"}
6. (Optional) Dump everything for backup
If you want all workflow columns:
.output full_workflows.json
SELECT * FROM workflow_entity;
.output stdout
7. Import into fresh n8n
Note: credentials won’t come back (they’re encrypted with your lost key). You’ll need to re-add them manually.
This way, you can fully recover your workflows from the DB, even without the lost encryption key. Hope you may recover your workflows.