N8n SQLite DB crashed - Is there hope?

Hi everyone,

this morning I noticed that our n8n instance suddenly reverted to a state from ~4 days ago after an automatic Docker container restart around 03:00.

n8n is running with SQLite on a persistent Docker volume.

For the last two weeks we’ve been working on a large workflow, which performs frequent reads and writes to internal data tables.

When inspecting last night’s backup (taken at 21:00), I found:

  • database.sqlite ~ 2.6 GB
  • database.sqlite-journal ~ 1.3 GB

I copied the database files from the backup and opened them with DBeaver (allowing journal recovery).
Unfortunately, the database also shows the same old state as the live instance — the changes from the last days are missing.

There are no -wal / -shm files, only the large journal file.

My questions:

  • Is there any realistic way to recover the missing changes from the SQLite DB / journal?
    Or should I accept the loss and recreate the changes from a GitHub push made last night?
  • I’m also very curious to understand why this happened:
    Are there recommended ways to investigate the root cause?
    I checked the n8n and container logs, but couldn’t find any helpful hints.

Either way, lesson learned — we will migrate to PostgreSQL to avoid this kind of issue in the future.

Any insight would be highly appreciated, especially if someone has seen a similar SQLite rollback after a container restart.

Thanks in advance :folded_hands:

Edit:
In the Logs i just found the following hint:

Maybe that could have helped…

Hey @raving1522 !

It seems that you just have answered to your own questions…

And I was in same boat as you some while ago.

Cheers!

Are you referring to the DB_SQLITE_POOL_SIZE or to the fact that were we reached a Point where migrating to pgsql is a necessary next step?

Darn… I hate those situations. But I am glad for the daily GitHub push of all workflows.

Again you nailed both of answers lol…

Follow your instincts :slight_smile:

Beside that, I just make a daily backup of .n8n folder and workflows again to Drive… better to have where to look.

Cheers!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.