core
core copied to clipboard
No recorder in database after (Recorder) SQLAlchemyError
The problem
Hello,
H.A can't record state in database after recorder error, I have to restart Toto so that writing is possible again
Other HA parts seem to work normally
2024-09-23 23:59:45.836 ERROR (Recorder) [homeassistant.components.recorder.core] SQLAlchemyError error processing task CommitTask()
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 900, in _process_one_task_or_event_or_recover
task.run(self)
File "/usr/src/homeassistant/homeassistant/components/recorder/tasks.py", line 291, in run
instance._commit_event_session_or_retry() # noqa: SLF001
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1197, in _commit_event_session_or_retry
self._commit_event_session()
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1223, in _commit_event_session
session.execute(
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2351, in execute
return self._execute_internal(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2236, in _execute_internal
result: Result[Any] = compile_state_cls.orm_execute_statement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/bulk_persistence.py", line 1603, in orm_execute_statement
result = _bulk_update(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/bulk_persistence.py", line 335, in _bulk_update
persistence._emit_update_statements(
File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/persistence.py", line 948, in _emit_update_statements
raise orm_exc.StaleDataError(
sqlalchemy.orm.exc.StaleDataError: UPDATE statement on table 'states' expected to update 12 row(s); 11 were matched.
Could you help me please
What version of Home Assistant Core has the issue?
2024.9.x
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Recorder
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response