The last couple of days I saw a bunch of errors appear in the error log. I am not sure what is causing it as I have recently added trackers and zoning. I commented those out of my configuration log but I still see these errors. Now the “history” part of HASS is not working and I believe it’s due to these errors. Can anyone help?
Running on a RPi3 using HASS 0.40
17-03-22 12:44:08 ERROR (Thread-10) [homeassistant.components.recorder.util] Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'SELECT states.state_id AS states_state_id, states.domain AS states_domain, states.entity_id AS states_entity_id, states.state AS states_state, states.attributes AS states_attributes, states.event_id AS states_event_id, states.last_changed AS states_last_changed, states.last_updated AS states_last_updated, states.created AS states_created \nFROM states JOIN (SELECT max(states.state_id) AS max_state_id \nFROM states \nWHERE states.created >= ? AND states.created < ? AND states.domain NOT IN (?, ?) AND states.domain NOT IN (?, ?) GROUP BY states.entity_id) AS anon_1 ON states.state_id = anon_1.max_state_id'] [parameters: ('2017-03-22 01:54:26.100203', '2017-03-22 04:00:00.000000', 'zone', 'scene', 'zone', 'scene')]
17-03-22 12:44:08 ERROR (Thread-10) [homeassistant.components.recorder.util] Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'SELECT states.state_id AS states_state_id, states.domain AS states_domain, states.entity_id AS states_entity_id, states.state AS states_state, states.attributes AS states_attributes, states.event_id AS states_event_id, states.last_changed AS states_last_changed, states.last_updated AS states_last_updated, states.created AS states_created \nFROM states JOIN (SELECT max(states.state_id) AS max_state_id \nFROM states \nWHERE states.created >= ? AND states.created < ? AND states.domain NOT IN (?, ?) AND states.domain NOT IN (?, ?) GROUP BY states.entity_id) AS anon_1 ON states.state_id = anon_1.max_state_id'] [parameters: ('2017-03-22 01:54:26.100203', '2017-03-22 04:00:00.000000', 'zone', 'scene', 'zone', 'scene')]
17-03-22 12:44:08 ERROR (Thread-10) [homeassistant.components.recorder.util] Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'SELECT states.state_id AS states_state_id, states.domain AS states_domain, states.entity_id AS states_entity_id, states.state AS states_state, states.attributes AS states_attributes, states.event_id AS states_event_id, states.last_changed AS states_last_changed, states.last_updated AS states_last_updated, states.created AS states_created \nFROM states JOIN (SELECT max(states.state_id) AS max_state_id \nFROM states \nWHERE states.created >= ? AND states.created < ? AND states.domain NOT IN (?, ?) AND states.domain NOT IN (?, ?) GROUP BY states.entity_id) AS anon_1 ON states.state_id = anon_1.max_state_id'] [parameters: ('2017-03-22 01:54:26.100203', '2017-03-22 04:00:00.000000', 'zone', 'scene', 'zone', 'scene')]
17-03-22 12:44:08 ERROR (Thread-10) [homeassistant.components.recorder.util] Error executing query: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'SELECT states.state_id AS states_state_id, states.domain AS states_domain, states.entity_id AS states_entity_id, states.state AS states_state, states.attributes AS states_attributes, states.event_id AS states_event_id, states.last_changed AS states_last_changed, states.last_updated AS states_last_updated, states.created AS states_created \nFROM states JOIN (SELECT max(states.state_id) AS max_state_id \nFROM states \nWHERE states.created >= ? AND states.created < ? AND states.domain NOT IN (?, ?) AND states.domain NOT IN (?, ?) GROUP BY states.entity_id) AS anon_1 ON states.state_id = anon_1.max_state_id'] [parameters: ('2017-03-22 01:54:26.100203', '2017-03-22 04:00:00.000000', 'zone', 'scene', 'zone', 'scene')]
17-03-22 12:44:08 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/engine/default.py", line 470, 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 "/home/homeassistant/.homeassistant/deps/aiohttp/web_server.py", line 62, in handle_request
resp = yield from self._handler(request)
File "/home/homeassistant/.homeassistant/deps/aiohttp/web.py", line 270, in _handle
resp = yield from handler(request)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/http/ban.py", line 58, in ban_middleware_handler
return (yield from handler(request))
File "/usr/lib/python3.4/asyncio/coroutines.py", line 143, in coro
res = yield from res
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/http/__init__.py", line 417, in handle
result = yield from result
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/history.py", line 238, in get
end_time, entity_id, self.filters)
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/history.py", line 82, in get_significant_states
return states_to_json(hass, states, start_time, entity_id, filters)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/history.py", line 158, in states_to_json
for state in get_states(hass, start_time, entity_ids, filters=filters):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/history.py", line 139, in get_states
return [state for state in execute(query)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/recorder/util.py", line 63, in execute
(row.to_native() for row in qry)
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/orm/query.py", line 2790, in __iter__
return self._execute_and_instances(context)
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/orm/query.py", line 2813, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/engine/base.py", line 945, in execute
return meth(self, multiparams, params)
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
compiled_sql, distilled_params
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/engine/base.py", line 1189, in _execute_context
context)
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/engine/base.py", line 1393, in _handle_dbapi_exception
exc_info
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/util/compat.py", line 186, in reraise
raise value.with_traceback(tb)
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/home/homeassistant/.homeassistant/deps/sqlalchemy/engine/default.py", line 470, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) database disk image is malformed [SQL: 'SELECT states.state_id AS states_state_id, states.domain AS states_domain, states.entity_id AS states_entity_id, states.state AS states_state, states.attributes AS states_attributes, states.event_id AS states_event_id, states.last_changed AS states_last_changed, states.last_updated AS states_last_updated, states.created AS states_created \nFROM states JOIN (SELECT max(states.state_id) AS max_state_id \nFROM states \nWHERE states.created >= ? AND states.created < ? AND states.domain NOT IN (?, ?) AND states.domain NOT IN (?, ?) GROUP BY states.entity_id) AS anon_1 ON states.state_id = anon_1.max_state_id'] [parameters: ('2017-03-22 01:54:26.100203', '2017-03-22 04:00:00.000000', 'zone', 'scene', 'zone', 'scene')]