Recorder purge error

I did a restore to a previous backup and am not getting the below error. Not sure if it’s related to the restore but I have commented pi recorder in config and restarted and tried to purge but that failed.

Any thoughts?


Log Details (WARNING)
Logger: homeassistant.components.recorder.purge
Source: components/recorder/purge.py:42 
Integration: Recorder (documentation, issues) 
First occurred: 20:51:01 (3 occurrences) 
Last logged: 20:51:52

Error purging history: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id) VALUES (?, ?, ?, ?, ?, ?, ?)] [parameters: ('state_changed', '{"entity_id": "sensor.time", "old_state": {"entity_id": "sensor.time", "state": "20:50", "attributes": {"friendly_name": "Time", "icon": "mdi:clock"} ... (366 characters truncated) ... :00", "last_updated": "2020-06-05T19:51:01.008884+00:00", "context": {"id": "211728b9315b40bfa0c31adf11f3ca0f", "parent_id": null, "user_id": null}}}', 'LOCAL', '2020-06-05 19:51:01.008989', '2020-06-05 19:51:01.047567', '211728b9315b40bfa0c31adf11f3ca0f', None)] (Background on this error at: http://sqlalche.me/e/4xp6) (Background on this error at: http://sqlalche.me/e/7s2a).
Error purging history: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id) VALUES (?, ?, ?, ?, ?, ?, ?)] [parameters: ('call_service', '{"domain": "recorder", "service": "purge", "service_data": {"keep_days": 0}}', 'LOCAL', '2020-06-05 19:51:36.163760', '2020-06-05 19:51:36.170320', 'b6191d5a7a354fc99278d4ab2206d84e', '8719925a3baf4f2c925372ec2d6d42ca')] (Background on this error at: http://sqlalche.me/e/4xp6) (Background on this error at: http://sqlalche.me/e/7s2a).
Error purging history: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transa

Your database is corrupted. Happens a lot during restore. Simple delete your database.
(home-assistant_v2.db in /config)

1 Like

Thank you it worked