<p><img class="alignnone size-full wp-image-3723" src="https://flowgenius.in/wp-content/uploads/2025/12/Blog-4-Cluster-5.png" alt="" /></p>
<p style="text-align: center;">Step by Step Guide to solve n8n SQLite Database Corrupt Error</p>
<p> </p>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Who this is for:</strong> Developers and DevOps engineers running n8n in production who need a reliable, step‑by‑step method to detect, back up, recover, and harden a corrupted SQLite database. For a complete guide on managing SQLite in n8n, including errors, performance, and migration, check out our <strong>n8n SQLite pillar guide</strong>.</p>
<hr style="border: none; margin: 50px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">Quick Diagnosis</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">If n8n throws <code>SQLITE_CORRUPT: database disk image is malformed</code>:</p>
<ol style="line-height: 1.9; margin-bottom: 1.7em;">
<li>Stop the n8n process – prevents further writes.</li>
<li>Back up the current <em>.sqlite</em> file.</li>
<li>Run the three‑step recovery below.</li>
</ol>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;"># 1. Verify corruption
sqlite3 /path/to/database.sqlite "PRAGMA integrity_check;"
# 2. Export data if integrity_check fails
sqlite3 /path/to/database.sqlite ".mode csv" ".output /tmp/n8n_backup.csv" "SELECT * FROM workflow;"
# 3. Replace the DB with a clean copy or recreate it
sqlite3 /path/to/database.sqlite < /path/to/clean_schema.sql
</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">After restoring, restart n8n (<code>pm2 restart n8n</code> or <code>docker compose up -d</code>).<br />
*If you have no recent backup, the CSV export is your last‑ditch recovery option.* Find out how to manage <a href="https://flowgenius.in/n8n-sqlite-disk-full-error/"><strong>disk space in n8n</strong></a>, prevent corruption, and optimize SQLite performance in n8n.</p>
<hr style="border: none; margin: 50px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">1. Detecting a Corrupt SQLite Database in n8n</h2>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Micro‑summary:</strong> Identify corruption before any write attempts, then halt the service.</p>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Symptom</th>
<th style="border: 1px solid #e0e0e0; padding: 13px;">n8n Log Message</th>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Immediate Action</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Workflow fails to load</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;"><code>Error: SQLITE_CORRUPT: database disk image is malformed</code></td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Stop n8n; avoid writes.</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Random HTTP 500 errors</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;"><code>DatabaseError: SQLITE_CORRUPT</code></td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Verify disk health (e.g., <code>smartctl</code>).</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Missing workflow nodes in UI</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">No explicit error</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Run <code>PRAGMA integrity_check;</code> manually.</td>
</tr>
</tbody>
</table>
<h3 style="margin-bottom: 45px; line-height: 1.3;">1.1 Run an Integrity Check</h3>
<blockquote style="margin: 0 0 2em 0; padding-left: 1em; border-left: 4px solid #e0e0e0; font-style: italic;"><p><strong>Purpose:</strong> Confirms whether the SQLite file is malformed.</p></blockquote>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;">sqlite3 /var/n8n/.n8n/database.sqlite "PRAGMA integrity_check;"
</pre>
<ul style="line-height: 1.9; margin-bottom: 1.7em;">
<li><strong>Result <code>ok</code></strong> → Corruption is not the cause; investigate other issues.</li>
<li><strong>Any error output</strong> → Corruption confirmed; proceed to backup.</li>
</ul>
<blockquote style="margin: 0 0 2em 0; padding-left: 1em; border-left: 4px solid #e0e0e0; font-style: italic;"><p><strong>EEFA Note:</strong> Running the check on a live instance can lock the DB. <strong>Stop n8n first</strong> (<code>pm2 stop n8n</code> or <code>docker stop n8n</code>) to capture a consistent snapshot.</p></blockquote>
<hr style="border: none; margin: 50px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">2. Safely Back Up the Corrupted Database</h2>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Micro‑summary:</strong> Preserve the exact corrupted file before attempting any extraction.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">2.1 Offline Copy</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;"># Stop n8n to avoid further writes
pm2 stop n8n # or `docker stop n8n`
# Copy the DB (preserves the exact corrupted state)
cp /var/n8n/.n8n/database.sqlite /tmp/database_corrupt_$(date +%F_%H%M).sqlite
</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">2.2 Export Recoverable Tables to CSV</h3>
<blockquote style="margin: 0 0 2em 0; padding-left: 1em; border-left: 4px solid #e0e0e0; font-style: italic;"><p><strong>Purpose:</strong> Pull out rows that are still readable. CSV is tolerant of partial corruption.</p></blockquote>
<h4 style="margin-bottom: 45px; line-height: 1.3;">Export Workflows</h4>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;">sqlite3 /tmp/database_corrupt_*.sqlite <<'SQL'
.mode csv
.output /tmp/n8n_workflows_backup.csv
SELECT * FROM workflow;
SQL
</pre>
<h4 style="margin-bottom: 45px; line-height: 1.3;">Export Credentials</h4>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;">sqlite3 /tmp/database_corrupt_*.sqlite <<'SQL'
.mode csv
.output /tmp/n8n_credentials_backup.csv
SELECT * FROM credential;
SQL
</pre>
<ul style="line-height: 1.9; margin-bottom: 1.7em;">
<li><strong>Why CSV?</strong> <code>VACUUM</code> aborts on corruption, but row‑wise reads often succeed.</li>
<li><strong>EEFA Warning:</strong> CSV does <strong>not</strong> retain binary data (e.g., encrypted credentials). Export those via the UI before corruption if possible.</li>
<li><a href="https://flowgenius.in/n8n-sqlite-performance-tuning-indexing-pragma-settings-amp-workflow-design-tips/"><strong>Optimize performance and prevent storage issues</strong></a> like corruption and disk full errors in n8n SQLite.</li>
</ul>
<hr style="border: none; margin: 50px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">3. Restoring from a Known Good Backup</h2>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Micro‑summary:</strong> Replace the broken file with a clean copy, or rebuild the DB from exported CSVs when no full backup exists.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">3.1 Restore a Recent <code>.sqlite</code> Backup</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;"># Rename the broken DB
mv /var/n8n/.n8n/database.sqlite /var/n8n/.n8n/database.sqlite.broken
# Copy the good backup into place
cp /backups/n8n/database_2025-12-20.sqlite /var/n8n/.n8n/database.sqlite
# Fix permissions (Docker containers often run as UID 1000)
chown 1000:1000 /var/n8n/.n8n/database.sqlite
chmod 600 /var/n8n/.n8n/database.sqlite
</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">Restart and verify:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;">pm2 start n8n # or `docker start n8n`
curl -s http://localhost:5678/rest/workflows | jq .
</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">3.2 Rebuild from CSV Export (No Full Backup)</h3>
<ol style="line-height: 1.9; margin-bottom: 1.7em;">
<li>Create a fresh schema – n8n ships a <code>schema.sql</code> file.</li>
</ol>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;">sqlite3 /var/n8n/.n8n/database.sqlite < /usr/local/lib/node_modules/n8n/dist/database/schema.sql
</pre>
<ol style="line-height: 1.9; margin-bottom: 1.7em;" start="2">
<li>Import the CSV data.</li>
</ol>
<h4 style="margin-bottom: 45px; line-height: 1.3;">Import Workflows</h4>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;">sqlite3 /var/n8n/.n8n/database.sqlite <<'SQL'
.mode csv
.import /tmp/n8n_workflows_backup.csv workflow
SQL
</pre>
<h4 style="margin-bottom: 45px; line-height: 1.3;">Import Credentials</h4>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;">sqlite3 /var/n8n/.n8n/database.sqlite <<'SQL'
.mode csv
.import /tmp/n8n_credentials_backup.csv credential
SQL
</pre>
<ol style="line-height: 1.9; margin-bottom: 1.7em;" start="3">
<li>Repair auto‑increment counters (SQLite does not auto‑fix <code>sqlite_sequence</code>).</li>
</ol>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;">sqlite3 /var/n8n/.n8n/database.sqlite "UPDATE sqlite_sequence SET seq = (SELECT MAX(id) FROM workflow) WHERE name='workflow';"
</pre>
<ol style="line-height: 1.9; margin-bottom: 1.7em;" start="4">
<li>Validate the rebuilt DB.</li>
</ol>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;">sqlite3 /var/n8n/.n8n/database.sqlite "PRAGMA integrity_check;"
</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">A return of <code>ok</code> confirms a healthy database. If errors persist, repeat the export for each table individually.</p>
<blockquote style="margin: 0 0 2em 0; padding-left: 1em; border-left: 4px solid #e0e0e0; font-style: italic;"><p><strong>EEFA Insight:</strong> Execution logs (<code>execution_entity</code> table) are lost during CSV import. Keep the original corrupted DB for forensic analysis if needed. Implement <a href="https://flowgenius.in/how-to-backup-and-restore-the-n8n-sqlite-database-stepbystep-guide/"><strong>backup and restore strategies </strong></a>to protect against database corruption and storage problems in n8n.</p></blockquote>
<hr style="border: none; margin: 50px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">4. Preventing Future Corruption</h2>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Micro‑summary:</strong> Apply SQLite‑level settings, OS‑level safeguards, and regular backups to minimize risk.</p>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Prevention Technique</th>
<th style="border: 1px solid #e0e0e0; padding: 13px;">How to Enable</th>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Why It Helps</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Write‑Ahead Logging (WAL)</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Add <code>journal_mode=WAL</code> to the SQLite connection string in <code>~/.n8n/config</code></td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Reduces lock contention; protects against abrupt shutdowns.</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Periodic <code>VACUUM</code></td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Cron: <code>0 3 * * * sqlite3 /var/n8n/.n8n/database.sqlite "VACUUM;"</code></td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Rewrites the file, eliminating fragmented pages.</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Filesystem Sync</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Mount volume with <code>sync</code> (<code>docker run -v n8n_data:/home/node/.n8n:rw,sync</code>)</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Forces immediate flushes, mitigating power‑loss corruption.</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Automated Backups</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Use <code>restic</code> or <code>rsnapshot</code> to copy <code>/var/n8n/.n8n/database.sqlite</code> hourly</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Guarantees a recent restore point before corruption spreads.</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Disk Health Monitoring</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;"><code>smartctl -a /dev/sda</code> + alert on reallocated sectors</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Disk errors are a leading cause of SQLite corruption.</td>
</tr>
</tbody>
</table>
<h3 style="margin-bottom: 45px; line-height: 1.3;">4.1 Enable WAL in a Docker Deployment</h3>
<blockquote style="margin: 0 0 2em 0; padding-left: 1em; border-left: 4px solid #e0e0e0; font-style: italic;"><p><strong>Purpose:</strong> Show the minimal <code>docker‑compose</code> changes required.</p></blockquote>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; line-height: 1.9; margin-bottom: 2em;">services:
n8n:
image: n8nio/n8n
environment:
- DB_TYPE=sqlite
- DB_SQLITE_DATABASE=/home/node/.n8n/database.sqlite
- DB_SQLITE_PRAGMA=journal_mode=WAL
volumes:
- n8n_data:/home/node/.n8n
restart: unless-stopped
</pre>
<blockquote style="margin: 0 0 2em 0; padding-left: 1em; border-left: 4px solid #e0e0e0; font-style: italic;"><p><strong>EEFA Reminder:</strong> WAL is incompatible with read‑only filesystems (e.g., some NFS mounts). Test in staging before production rollout.</p></blockquote>
<hr style="border: none; margin: 50px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">5. Verifying Recovery & Going Live</h2>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Micro‑summary:</strong> Perform quick sanity checks to ensure the service is stable after restoration.</p>
<ol style="line-height: 1.9; margin-bottom: 1.7em;">
<li>Smoke Test – Trigger a simple “Hello World” workflow via UI or API.</li>
<li>Log Review – Confirm no <code>SQLITE_CORRUPT</code> entries appear in <code>~/.n8n/logs</code>.</li>
<li>Metrics Check – If using Prometheus, verify <code>sqlite_db_size_bytes</code> remains stable (no sudden spikes).</li>
</ol>
<p style="margin-bottom: 2em; line-height: 1.9;">When all checks pass, the recovery is complete.</p>
<hr style="border: none; margin: 50px 0;" />
<p style="margin-bottom: 2em; line-height: 1.9;"><em>All commands assume a Linux host; adapt paths for Windows/macOS accordingly. For Docker‑only deployments, replace <code>/var/n8n/.n8n/</code> with the container’s volume mount point (<code>/home/node/.n8n/</code>).</em></p>

Step by Step Guide to solve n8n SQLite Database Corrupt Error
Who this is for: Developers and DevOps engineers running n8n in production who need a reliable, step‑by‑step method to detect, back up, recover, and harden a corrupted SQLite database. For a complete guide on managing SQLite in n8n, including errors, performance, and migration, check out our n8n SQLite pillar guide.
Quick Diagnosis
If n8n throws SQLITE_CORRUPT: database disk image is malformed:
- Stop the n8n process – prevents further writes.
- Back up the current .sqlite file.
- Run the three‑step recovery below.
# 1. Verify corruption
sqlite3 /path/to/database.sqlite "PRAGMA integrity_check;"
# 2. Export data if integrity_check fails
sqlite3 /path/to/database.sqlite ".mode csv" ".output /tmp/n8n_backup.csv" "SELECT * FROM workflow;"
# 3. Replace the DB with a clean copy or recreate it
sqlite3 /path/to/database.sqlite < /path/to/clean_schema.sql
After restoring, restart n8n (pm2 restart n8n or docker compose up -d).
*If you have no recent backup, the CSV export is your last‑ditch recovery option.* Find out how to manage disk space in n8n, prevent corruption, and optimize SQLite performance in n8n.
1. Detecting a Corrupt SQLite Database in n8n
Micro‑summary: Identify corruption before any write attempts, then halt the service.
| Symptom |
n8n Log Message |
Immediate Action |
| Workflow fails to load |
Error: SQLITE_CORRUPT: database disk image is malformed |
Stop n8n; avoid writes. |
| Random HTTP 500 errors |
DatabaseError: SQLITE_CORRUPT |
Verify disk health (e.g., smartctl). |
| Missing workflow nodes in UI |
No explicit error |
Run PRAGMA integrity_check; manually. |
1.1 Run an Integrity Check
Purpose: Confirms whether the SQLite file is malformed.
sqlite3 /var/n8n/.n8n/database.sqlite "PRAGMA integrity_check;"
- Result
ok → Corruption is not the cause; investigate other issues.
- Any error output → Corruption confirmed; proceed to backup.
EEFA Note: Running the check on a live instance can lock the DB. Stop n8n first (pm2 stop n8n or docker stop n8n) to capture a consistent snapshot.
2. Safely Back Up the Corrupted Database
Micro‑summary: Preserve the exact corrupted file before attempting any extraction.
2.1 Offline Copy
# Stop n8n to avoid further writes
pm2 stop n8n # or `docker stop n8n`
# Copy the DB (preserves the exact corrupted state)
cp /var/n8n/.n8n/database.sqlite /tmp/database_corrupt_$(date +%F_%H%M).sqlite
2.2 Export Recoverable Tables to CSV
Purpose: Pull out rows that are still readable. CSV is tolerant of partial corruption.
Export Workflows
sqlite3 /tmp/database_corrupt_*.sqlite <<'SQL'
.mode csv
.output /tmp/n8n_workflows_backup.csv
SELECT * FROM workflow;
SQL
Export Credentials
sqlite3 /tmp/database_corrupt_*.sqlite <<'SQL'
.mode csv
.output /tmp/n8n_credentials_backup.csv
SELECT * FROM credential;
SQL
- Why CSV?
VACUUM aborts on corruption, but row‑wise reads often succeed.
- EEFA Warning: CSV does not retain binary data (e.g., encrypted credentials). Export those via the UI before corruption if possible.
- Optimize performance and prevent storage issues like corruption and disk full errors in n8n SQLite.
3. Restoring from a Known Good Backup
Micro‑summary: Replace the broken file with a clean copy, or rebuild the DB from exported CSVs when no full backup exists.
3.1 Restore a Recent .sqlite Backup
# Rename the broken DB
mv /var/n8n/.n8n/database.sqlite /var/n8n/.n8n/database.sqlite.broken
# Copy the good backup into place
cp /backups/n8n/database_2025-12-20.sqlite /var/n8n/.n8n/database.sqlite
# Fix permissions (Docker containers often run as UID 1000)
chown 1000:1000 /var/n8n/.n8n/database.sqlite
chmod 600 /var/n8n/.n8n/database.sqlite
Restart and verify:
pm2 start n8n # or `docker start n8n`
curl -s http://localhost:5678/rest/workflows | jq .
3.2 Rebuild from CSV Export (No Full Backup)
- Create a fresh schema – n8n ships a
schema.sql file.
sqlite3 /var/n8n/.n8n/database.sqlite < /usr/local/lib/node_modules/n8n/dist/database/schema.sql
- Import the CSV data.
Import Workflows
sqlite3 /var/n8n/.n8n/database.sqlite <<'SQL'
.mode csv
.import /tmp/n8n_workflows_backup.csv workflow
SQL
Import Credentials
sqlite3 /var/n8n/.n8n/database.sqlite <<'SQL'
.mode csv
.import /tmp/n8n_credentials_backup.csv credential
SQL
- Repair auto‑increment counters (SQLite does not auto‑fix
sqlite_sequence).
sqlite3 /var/n8n/.n8n/database.sqlite "UPDATE sqlite_sequence SET seq = (SELECT MAX(id) FROM workflow) WHERE name='workflow';"
- Validate the rebuilt DB.
sqlite3 /var/n8n/.n8n/database.sqlite "PRAGMA integrity_check;"
A return of ok confirms a healthy database. If errors persist, repeat the export for each table individually.
EEFA Insight: Execution logs (execution_entity table) are lost during CSV import. Keep the original corrupted DB for forensic analysis if needed. Implement backup and restore strategies to protect against database corruption and storage problems in n8n.
4. Preventing Future Corruption
Micro‑summary: Apply SQLite‑level settings, OS‑level safeguards, and regular backups to minimize risk.
| Prevention Technique |
How to Enable |
Why It Helps |
| Write‑Ahead Logging (WAL) |
Add journal_mode=WAL to the SQLite connection string in ~/.n8n/config |
Reduces lock contention; protects against abrupt shutdowns. |
Periodic VACUUM |
Cron: 0 3 * * * sqlite3 /var/n8n/.n8n/database.sqlite "VACUUM;" |
Rewrites the file, eliminating fragmented pages. |
| Filesystem Sync |
Mount volume with sync (docker run -v n8n_data:/home/node/.n8n:rw,sync) |
Forces immediate flushes, mitigating power‑loss corruption. |
| Automated Backups |
Use restic or rsnapshot to copy /var/n8n/.n8n/database.sqlite hourly |
Guarantees a recent restore point before corruption spreads. |
| Disk Health Monitoring |
smartctl -a /dev/sda + alert on reallocated sectors |
Disk errors are a leading cause of SQLite corruption. |
4.1 Enable WAL in a Docker Deployment
Purpose: Show the minimal docker‑compose changes required.
services:
n8n:
image: n8nio/n8n
environment:
- DB_TYPE=sqlite
- DB_SQLITE_DATABASE=/home/node/.n8n/database.sqlite
- DB_SQLITE_PRAGMA=journal_mode=WAL
volumes:
- n8n_data:/home/node/.n8n
restart: unless-stopped
EEFA Reminder: WAL is incompatible with read‑only filesystems (e.g., some NFS mounts). Test in staging before production rollout.
5. Verifying Recovery & Going Live
Micro‑summary: Perform quick sanity checks to ensure the service is stable after restoration.
- Smoke Test – Trigger a simple “Hello World” workflow via UI or API.
- Log Review – Confirm no
SQLITE_CORRUPT entries appear in ~/.n8n/logs.
- Metrics Check – If using Prometheus, verify
sqlite_db_size_bytes remains stable (no sudden spikes).
When all checks pass, the recovery is complete.
All commands assume a Linux host; adapt paths for Windows/macOS accordingly. For Docker‑only deployments, replace /var/n8n/.n8n/ with the container’s volume mount point (/home/node/.n8n/).