Direct answer: Do not keep restarting or copying a live SQLite file. First create a full Home Assistant backup and confirm at least 2.5 times the database size is available as free storage, then stop Home Assistant before touching the database. Home Assistant can move an unrecoverable SQLite database aside and create a new one, which restores operation but may leave history in the old file. Preserve every displaced database before attempting recovery. If long-term statistics matter, treat recovery as a data-preservation job rather than a quick delete-and-reboot fix.
This guide addresses a malformed or corrupt Home Assistant Recorder database. It is designed to preserve working configuration and evidence before any reset, deletion, or re-pairing. Work in order and stop when the first confirmed cause is corrected. Screens and menu labels can vary by Home Assistant release and installation method.
Symptoms and scope
Use the following signs to decide whether this guide matches your problem. Similar-looking failures can come from different layers, so record what still works as carefully as what fails.
- The log contains “database disk image is malformed,” “unrecoverable sqlite3 database corruption detected,” “database is locked,” or repeated Recorder write failures.
- History, Logbook, Energy, or statistics stop updating while automations and device control continue to work.
- A file with a name such as home-assistant_v2.db.corrupt appears and a fresh database starts growing.
- Startup or shutdown becomes unusually slow, purge or repack repeatedly fails, or the host runs low on storage.
- The problem returns after replacing the database, suggesting an underlying disk, power, memory, filesystem, or shutdown issue.
Most likely causes, ranked
Start with the causes that fit the evidence. Do not apply every fix at once: simultaneous changes make it impossible to know what solved the problem and can create a second failure.
- 1. An interrupted write caused by sudden power loss, forced VM termination, storage disconnect, or a host crash.
- 2. A failing SD card, SSD, USB bridge, filesystem, or hypervisor storage layer is returning incomplete or inconsistent writes.
- 3. The disk is full or nearly full, leaving too little room for SQLite journaling, purge, repack, backups, or host updates.
- 4. The live SQLite file was copied, opened, repaired, or manipulated while Home Assistant still had it open.
- 5. Very heavy state recording, noisy sensors, short-retention experimentation, or an oversized database increased I/O pressure; size alone does not prove corruption.
- 6. A network filesystem or unsupported storage arrangement introduced locking behavior that SQLite was not designed to tolerate.
Safe diagnostic procedure
Before beginning, make a current backup when the procedure could affect configuration or stored data. Record the Home Assistant version, installation type, device or app version, the first failure time, and the last known working change. Redact secrets from every screenshot and log excerpt.
Step 1: Capture the exact failure
Open Settings → System → Repairs and Settings → System → Logs. Save the exact Recorder and SQLite messages with timestamps. Redact tokens, passwords, public URLs, GPS coordinates, and device identifiers before sharing anything. Distinguish a one-time recovery notice from an error that repeats every few minutes.
Interpretation: if this step changes the symptom, repeat the same controlled test once before moving on. If nothing changes, restore any temporary setting and continue. Keep a short note of the time, action, and result; that record prevents circular troubleshooting.
Step 2: Protect the current state
Create a full Home Assistant backup before changing Recorder settings. Download or copy the backup to storage outside the same failing device. A backup that exists only on the questionable disk is not a complete safety net. Record the Core version, installation type, database engine, and approximate database size.
Interpretation: if this step changes the symptom, repeat the same controlled test once before moving on. If nothing changes, restore any temporary setting and continue. Keep a short note of the time, action, and result; that record prevents circular troubleshooting.
Step 3: Verify the affected layer
Check free space and host health. Home Assistant OS users can inspect System → Storage and hardware information; container and supervised users should also inspect the host filesystem and container volume. Leave meaningful headroom for the database, journal, backup, and updates. Remove only known expendable files through supported interfaces.
Interpretation: if this step changes the symptom, repeat the same controlled test once before moving on. If nothing changes, restore any temporary setting and continue. Keep a short note of the time, action, and result; that record prevents circular troubleshooting.
Step 4: Test the least-destructive cause
Stop Home Assistant cleanly before copying or inspecting SQLite. Do not use Samba, an editor, a database browser, or a repair command against the live file. If the installation cannot stop cleanly, preserve a backup and investigate storage and host logs before forcing power off.
Interpretation: if this step changes the symptom, repeat the same controlled test once before moving on. If nothing changes, restore any temporary setting and continue. Keep a short note of the time, action, and result; that record prevents circular troubleshooting.
Step 5: Inspect configuration and identity
Preserve the original database and any .corrupt copies with their timestamps. Never overwrite the only damaged copy with a repaired experiment. Work on a duplicate. If Home Assistant already created a fresh database, confirm that current history is writing before deciding whether old data needs recovery.
Interpretation: if this step changes the symptom, repeat the same controlled test once before moving on. If nothing changes, restore any temporary setting and continue. Keep a short note of the time, action, and result; that record prevents circular troubleshooting.
Step 6: Check network, power, or permissions
For the fastest safe service restoration, allow Home Assistant to use a new database. This sacrifices ordinary short-term history from the damaged file but should not require deleting configuration, devices, entities, or automations. Long-term statistics may require separate recovery and careful validation.
Interpretation: if this step changes the symptom, repeat the same controlled test once before moving on. If nothing changes, restore any temporary setting and continue. Keep a short note of the time, action, and result; that record prevents circular troubleshooting.
Step 7: Apply the narrow repair
If historical or energy data is important, use SQLite’s documented recovery process only on an offline duplicate and preferably with an experienced administrator. Validate recovered tables and statistics before any import. A file that opens is not automatically internally consistent.
Interpretation: if this step changes the symptom, repeat the same controlled test once before moving on. If nothing changes, restore any temporary setting and continue. Keep a short note of the time, action, and result; that record prevents circular troubleshooting.
Step 8: Observe through a full cycle
Reduce recurrence risk only after the service is stable. Exclude high-frequency entities from Recorder when their history provides no value, correct sensors that update excessively, maintain backups, and address storage or power faults. Moving to MariaDB can change operational characteristics but does not cure failing hardware or unsafe shutdowns.
Interpretation: if this step changes the symptom, repeat the same controlled test once before moving on. If nothing changes, restore any temporary setting and continue. Keep a short note of the time, action, and result; that record prevents circular troubleshooting.
Installation and environment branches
Home Assistant OS or appliance-style installs
Home Assistant OS: favor built-in backups, Repairs, storage information, and supported add-ons; avoid unsupported host-level file changes.
Container, network, or account variation
Container: verify the /config volume, filesystem ownership, available inodes, Docker shutdown behavior, and whether the database lives on reliable local storage.
Partial failure versus complete failure
Virtual machine: check the hypervisor for snapshots, thin-provisioned disk exhaustion, datastore latency, forced resets, and host power events.
Multi-device or multi-hop environments
External SQL database: a connection or credential failure is not the same as SQLite corruption. Inspect the database server, network path, permissions, capacity, and server logs before changing Recorder URLs.
What not to do
- Do not delete the integration, device, database, app registration, or proxy configuration merely because it is the fastest visible button. Deletion can remove evidence and create new entity identities.
- Do not paste passwords, tokens, encryption keys, exact home coordinates, public URLs with credentials, or unredacted logs into a forum or support ticket.
- Do not disable firewalls, TLS verification, authentication, or other security controls as a permanent workaround. A useful test must be narrow, timed, and reversed.
- Do not make several network, software, and device changes together. Change one variable, observe the result, and keep the working rollback path.
- Do not assume a restart is a diagnosis. A restart can temporarily hide timing, memory, radio, storage, or connectivity faults without correcting them.
Verification checklist
After recovery, restart once and watch Recorder logs for at least one normal write cycle. Open History and Logbook, change a harmless test entity, and confirm a new state appears with the correct time. Check Statistics in Developer Tools for repair notices and verify the Energy dashboard on the next statistics cycle. Recheck free storage and confirm no new .corrupt file appears. A clean dashboard alone is not proof; the log and fresh database writes must agree.
- The original symptom is gone under the same conditions that previously reproduced it.
- The relevant log has no new matching error after a normal update or restart cycle.
- Related entities, history, automations, or remote access still work.
- The repair survives one controlled restart of the affected component.
- Temporary troubleshooting exceptions have been removed or documented.
Rollback and recovery
If a recovery attempt makes matters worse, stop and return to the untouched copy or full backup. Restore into a test instance when possible, not directly over the only working production system. If statistics are business-critical, preserve both the old and new databases and seek database-specific help. Never merge rows by guesswork: entity and metadata identifiers can differ across databases.
If the evidence points to failing hardware, a vendor outage, an upstream regression, or corrupted data that matters, stop improvising. Preserve the backup and diagnostic record, then escalate with the exact version, timestamp, error, minimal reproduction, and steps already tested. That produces a safer and faster answer than repeated resets.
Prevention
- Use reliable storage and a UPS where outages are common.
- Keep tested backups outside the Home Assistant host.
- Shut down the host cleanly before power or storage work.
- Review Recorder exclusions for noisy, low-value entities.
- Watch storage capacity and database growth monthly.
- Investigate repeat corruption as a hardware or platform fault, not normal maintenance.
Schedule a brief review after the next Home Assistant update or device firmware change. Confirm that the repaired path still works, remove obsolete workarounds, and update your private documentation. Prevention is most effective when it records why a setting exists, not just its value.
Diagnostic worksheet
For a malformed or corrupt Home Assistant Recorder database, write down five facts before asking for help: the exact error, the first failure time, the last working time, the smallest action that reproduces it, and the layer that still works. Add the Home Assistant Core version, installation type, relevant device or app firmware, network path, and whether the issue survives a restart. This worksheet separates a repeatable defect from a transient outage.
If you observe: The log contains “database disk image is malformed,” “unrecoverable sqlite3 database corruption detected,” “database is locked,” or repeated Recorder write failures
Confirm when this began and whether it affects one entity, one device, one integration, or the whole installation. Compare the result on the same network and, when relevant, through the alternate path. Then use the matching diagnostic step above. Do not jump to recovery until the observation is repeatable or the logs identify the failing layer.
If you observe: History, Logbook, Energy, or statistics stop updating while automations and device control continue to work
Confirm when this began and whether it affects one entity, one device, one integration, or the whole installation. Compare the result on the same network and, when relevant, through the alternate path. Then use the matching diagnostic step above. Do not jump to recovery until the observation is repeatable or the logs identify the failing layer.
If you observe: A file with a name such as home-assistant_v2
Confirm when this began and whether it affects one entity, one device, one integration, or the whole installation. Compare the result on the same network and, when relevant, through the alternate path. Then use the matching diagnostic step above. Do not jump to recovery until the observation is repeatable or the logs identify the failing layer.
If you observe: Startup or shutdown becomes unusually slow, purge or repack repeatedly fails, or the host runs low on storage
Confirm when this began and whether it affects one entity, one device, one integration, or the whole installation. Compare the result on the same network and, when relevant, through the alternate path. Then use the matching diagnostic step above. Do not jump to recovery until the observation is repeatable or the logs identify the failing layer.
If you observe: The problem returns after replacing the database, suggesting an underlying disk, power, memory, filesystem, or shutdown issue
Confirm when this began and whether it affects one entity, one device, one integration, or the whole installation. Compare the result on the same network and, when relevant, through the alternate path. Then use the matching diagnostic step above. Do not jump to recovery until the observation is repeatable or the logs identify the failing layer.
Frequently asked questions
Should I delete and add everything again?
Usually not. Re-adding can change entity IDs, erase evidence, and hide the original cause. Use it only after backup, documentation, and the narrower checks in this guide.
Can I ignore the error if it starts working again?
A single brief interruption may be harmless, but a recurring error deserves timestamps and logs. Repetition after the same event often reveals a network, storage, power, permission, or token lifecycle problem.
Is updating Home Assistant always the fix?
No. Updates can contain fixes, but they also change dependencies and behavior. Read release notes, back up first, and match the error to a known fix before treating an update as diagnosis.
How much log information should I share?
Share the smallest relevant window around the failure, with secrets and personal data removed. Include versions and the exact action that caused the event. Avoid uploading complete logs publicly.
When should I escalate?
Escalate when safety, important data, repeated corruption, an upstream regression, or an account-side failure is involved, or when the least-destructive checks produce a clear error you cannot resolve.
Sources and review notes
Photo: Taylor Vick on Unsplash. Last reviewed: September 24, 2026. Official documentation is the authority for supported configuration. Community and issue reports are useful for identifying recurring symptoms but do not prove that every installation has the same cause.
- https://www.home-assistant.io/integrations/recorder/
- https://www.home-assistant.io/common-tasks/general/#backups
- https://www.sqlite.org/recovery.html
Continue with the Device Unavailable Diagnostic, the Smart-Home Diagnostic Decision Tree, or the Home Assistant Error Decoder when the symptom crosses more than one integration.







