ERROR components/recorder/__init__.py:509

I did a A Snapshot of my VM Ware macinge that i have my Hassio in Then i treied to install the new Homeassistant Version and Hassio with a lot of broblem So i roetord my snap shot and getting thiss error alot.

Any advice

Logger: homeassistant.components.recorder
Source: components/recorder/init.py:509
Integration: Recorder (documentation, issues)
First occurred: 7:30:20 AM (179 occurrences)
Last logged: 8:18:28 AM

  • Error saving events: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)] [parameters: (‘state_changed’, ‘{}’, ‘LOCAL’, ‘2020-12-25 07:17:28.887421’, ‘2020-12-25 07:17:28.887421’, ‘ed4b4d47aaccfbc4321a1b3edb139103’, None, None)] (Background on this error at: http://sqlalche.me/e/13/4xp6)
  • Error saving events: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)] [parameters: (‘state_changed’, ‘{}’, ‘LOCAL’, ‘2020-12-25 07:17:29.423762’, ‘2020-12-25 07:17:29.423762’, ‘9d4339658fe514a8f8dbde3aeb45ad03’, None, None)] (Background on this error at: http://sqlalche.me/e/13/4xp6)
  • Error saving events: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)] [parameters: (‘state_changed’, ‘{}’, ‘LOCAL’, ‘2020-12-25 07:18:24.695627’, ‘2020-12-25 07:18:24.695627’, ‘274983bbd52822adb18964d1964213f7’, None, None)] (Background on this error at: http://sqlalche.me/e/13/4xp6)
  • Error saving events: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)] [parameters: (‘state_changed’, ‘{}’, ‘LOCAL’, ‘2020-12-25 07:18:25.316739’, ‘2020-12-25 07:18:25.316739’, ‘a036adb94adc544683dbc40cb4f1b04b’, None, None)] (Background on this error at: http://sqlalche.me/e/13/4xp6)
  • Error saving events: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)] [parameters: (‘state_changed’, ‘{}’, ‘LOCAL’, ‘2020-12-25 07:18:27.214164’, ‘2020-12-25 07:18:27.214164’, ‘48b0a4e8a68f62f123e7b233f000c7b4’, None, None)] (Background on this error at: http://sqlalche.me/e/13/4xp6)

Traceback (most recent call last): File “/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py”, line 1276, in _execute_context self.dialect.do_execute( File “/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/default.py”, line 593, in do_execute cursor.execute(statement, parameters) sqlite3.DatabaseError: database disk image is malformed

Sounds like a database issue. Delete the database (home_assistant_v2.db) and restart HA. HA will automatically create a new one.

2 Likes

Thanks that did the trick :slight_smile:

I recently upgraded from 0.117 to latest and have the same problem.

Problem is I do have values (mostly in utility_meter) that I want to keep. So I don’t want to just delete the DB without a way of saving some of these values.

Is there a way to backup and restore some of those values?