Recorder issue / I have commented it out any ideas why?

It looks like for some reason I have commented out the recorder section of my config? Why would I have done this?

I must have done it recently as have been able to see status like this recentlyish, but I cannot for the life of me remember doing this?

The device tracker part of my IOS HA app knows I am at work and when I got here. My status shows as at work, but the history graph shows home all the time and my logbook is empty. I am sure I have missed a breaking change in an update (running 0.116.0) but any help would be great

My log shows recorder errors, such as this:

Logger: homeassistant.components.recorder
Source: components/recorder/__init__.py:497
Integration: Recorder (documentation, issues)
First occurred: 4:12:06 AM (41056 occurrences)
Last logged: 5:25:39 PM

Error saving events: Instance <States at 0x58bda6b8> is not present in this Session
Error saving events: Instance <States at 0x63c59928> is not present in this Session

showing at work:

history showing at home and no update
Capture2

Please upgrade to 0.116.1

Hi facing the same issue, already updated to from 0.116.1 to 0.116.2

Same problem…no logbook or history, I am using 0.116.2

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: ('call_service', '{"domain": "light", "service": "turn_off", "service_data": {"entity_id": "light.linear_nortek_security_control_llc_lb60z_1_dimmable_led_light_bulb_level_8"}}', 'LOCAL', '2020-10-09 19:27:04.773461', '2020-10-09 19:27:05.008304', '69c99e3b0a6511eba1d31b9e8fee1f58', 'f5d1b2130b4b480abf7747662d16e423', None)]
(Background on this error at: http://sqlalche.me/e/13/4xp6)
2020-10-09 12:27:06 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', '2020-10-09 19:27:05.414950', '2020-10-09 19:27:06.017665', '6a2b90b80a6511eb80d29fdcd816fb25', None, None)]
(Background on this error at: http://sqlalche.me/e/13/4xp6)
2020-10-09 12:27:06 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', '2020-10-09 19:27:05.414950', '2020-10-09 19:27:06.017665', '6a2b90b80a6511eb80d29fdcd816fb25', 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 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 493, in _commit_event_session
    self.event_session.flush()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2523, in flush
    self._flush(objects)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2664, in _flush
    transaction.rollback(_capture_exception=True)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2624, in _flush
    flush_context.execute()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 419, in execute
    n.execute_aggregate(self, set_)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 521, in execute_aggregate
    self.execute(uow)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 586, in execute
    persistence.save_obj(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 239, in save_obj
    _emit_insert_statements(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 1135, in _emit_insert_statements
    result = cached_connections[connection].execute(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1011, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1124, in _execute_clauseelement
    ret = self._execute_context(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context
    self._handle_dbapi_exception(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapi_exception
    util.raise_(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
  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)
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', '2020-10-09 19:27:05.414950', '2020-10-09 19:27:06.017665', '6a2b90b80a6511eb80d29fdcd816fb25', None, None)]
(Background on this error at: http://sqlalche.me/e/13/4xp6)

History just keeps loading…

I saw something similar to this error on a dry-run test attempting to migrate my homeassistant setup to a different box (hardware, rpi). I assumed this was due to the upgraded python 3.8.5 on the new host, so I didn’t think much of it and I thought it may go away if I delete config/home-assistant_v2.db which I do not mind losing and regenerating anyway.

You may try that if you dont mind losing historical data and see if that makes the error go away.

Your sqlite database is corrupt.

You can try to recover it (sqlite - How to recover a corrupt SQLite3 database? - Stack Overflow) or move it away from /config/home-assistant_v2.db and restart

Thank you very much! I appreciate your help. I renamed the file, home-assistant_v2.db to old-home-assistant_v2.db and rebooted. All ok now. Thanks again.