Sqlalchemy.exc DatabaseError

I am getting this error in my Core Log. I’ve deleted the home-assistant_v2.db file and it’s recreated after a reboot but I still get this error. Can anyone shed light on what this could be caused by and how to remedy it?

sqlalchemy.exc.DatabaseError: (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', '2021-01-21 21:21:54.446642', '2021-01-21 21:21:54.446642', '613e1d1f5676bef9ca235d6d797772e5', None, None)]
(Background on this error at: http://sqlalche.me/e/13/4xp6)
2021-01-21 18:01:00 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: (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', '2021-01-21 21:21:56.465140', '2021-01-21 21:21:56.465140', '72e1b3da3413fb99da94ab835c654e77', None, None)]
(Background on this error at: http://sqlalche.me/e/13/4xp6)
2021-01-21 18:01:00 ERROR (Recorder) [homeassistant.components.recorder] 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', '2021-01-21 21:21:56.465140', '2021-01-21 21:21:56.465140', '72e1b3da3413fb99da94ab835c654e77', 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
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 454, in _commit_event_session_or_retry
    self._commit_event_session()

Delete it, restart HA

Delete what? I’ve deleted the home-assistant_v2.db file and it’s recreated after a reboot but I still get this error. There is no change. Are there other database files? or is the home-assistant_v2.db file the only one?

That’s the only one. Maybe your SD card is failing…