Mon problème
Bonjour à tous,
Après une mise à jour vers HA Core 2024.4.2, la mise à jour de la base de données échoue
J’utilise TimescaleDB.
Il y 2 entrées dans le journal d’erreur suite à la MàJ du Core :
Enregistreur: homeassistant.components.recorder.util
Source: components/recorder/util.py:144
intégration: Recorder (documentation, problèmes)
S’est produit pour la première fois: 11:35:53 (1 occurrences)
Dernier enregistrement: 11:35:53
Error executing query: (psycopg2.errors.NotNullViolation) null value in column « change_id » of relation « schema_changes » violates not-null constraint DETAIL: Failing row contains (null, 43, 2024-04-10 09:35:53.3733+00). [SQL: INSERT INTO schema_changes (schema_version, changed) VALUES (%(schema_version)s, %(changed)s) RETURNING schema_changes.change_id] [parameters: {‹ schema_version ›: 43, ‹ changed ›: datetime.datetime(2024, 4, 10, 9, 35, 53, 373300, tzinfo=datetime.timezone.utc)}] (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)
Traceback (most recent call last):
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 1971, in _exec_single_context
self.dialect.do_execute(
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py », line 919, in do_execute
cursor.execute(statement, parameters)
psycopg2.errors.NotNullViolation: null value in column « change_id » of relation « schema_changes » violates not-null constraint
DETAIL: Failing row contains (null, 43, 2024-04-10 09:35:53.3733+00).
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File « /usr/src/homeassistant/homeassistant/components/recorder/util.py », line 144, in session_scope
session.commit()
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py », line 1972, in commit
trans.commit(_to_root=True)
File « », line 2, in commit
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py », line 139, in _go
ret_value = fn(self, *arg, **kw)
[floatl] ^^^^^^^^^^^^^^^^^^^[1]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py », line 1257, in commit
self._prepare_impl()
File « », line 2, in _prepare_impl
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py », line 139, in _go
ret_value = fn(self, *arg, **kw)
[floatl] ^^^^^^^^^^^^^^^^^^^[2]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py », line 1232, in _prepare_impl
self.session.flush()
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py », line 4296, in flush
self._flush(objects)
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py », line 4431, in _flush
with util.safe_reraise():
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py », line 146, in exit
raise exc_value.with_traceback(exc_tb)
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py », line 4392, in _flush
flush_context.execute()
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/unitofwork.py », line 466, in execute
rec.execute(self)
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/unitofwork.py », line 642, in execute
util.preloaded.orm_persistence.save_obj(
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/persistence.py », line 93, in save_obj
_emit_insert_statements(
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/persistence.py », line 1233, in _emit_insert_statements
result = connection.execute(
[floatl] ^^^^^^^^^^^^^^^^^^[3]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 1422, in execute
return meth(
[floatl] ^^^^[4]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py », line 514, in _execute_on_connection
return connection._execute_clauseelement(
[floatl] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[5]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 1644, in _execute_clauseelement
ret = self._execute_context(
[floatl] ^^^^^^^^^^^^^^^^^^^^^[6]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 1850, in _execute_context
return self._exec_single_context(
[floatl] ^^^^^^^^^^^^^^^^^^^^^^^^^[7]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 1990, in _exec_single_context
self._handle_dbapi_exception(
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 2357, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 1971, in _exec_single_context
self.dialect.do_execute(
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py », line 919, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column « change_id » of relation « schema_changes » violates not-null constraint
DETAIL: Failing row contains (null, 43, 2024-04-10 09:35:53.3733+00).
[SQL: INSERT INTO schema_changes (schema_version, changed) VALUES (%(schema_version)s, %(changed)s) RETURNING schema_changes.change_id]
[parameters: {‹ schema_version ›: 43, ‹ changed ›: datetime.datetime(2024, 4, 10, 9, 35, 53, 373300, tzinfo=datetime.timezone.utc)}]
(Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)
et
Enregistreur: homeassistant.components.recorder.core
Source: components/recorder/core.py:981
intégration: Recorder (documentation, problèmes)
S’est produit pour la première fois: 11:35:53 (1 occurrences)
Dernier enregistrement: 11:35:53
Database error during schema migration
Traceback (most recent call last):
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 1971, in _exec_single_context
self.dialect.do_execute(
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py », line 919, in do_execute
cursor.execute(statement, parameters)
psycopg2.errors.NotNullViolation: null value in column « change_id » of relation « schema_changes » violates not-null constraint
DETAIL: Failing row contains (null, 43, 2024-04-10 09:35:53.3733+00).
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File « /usr/src/homeassistant/homeassistant/components/recorder/core.py », line 981, in _migrate_schema_and_setup_run
migration.migrate_schema(
File « /usr/src/homeassistant/homeassistant/components/recorder/migration.py », line 275, in migrate_schema
with session_scope(session=session_maker()) as session:
File « /usr/local/lib/python3.12/contextlib.py », line 144, in exit
next(self.gen)
File « /usr/src/homeassistant/homeassistant/components/recorder/util.py », line 144, in session_scope
session.commit()
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py », line 1972, in commit
trans.commit(_to_root=True)
File « », line 2, in commit
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py », line 139, in _go
ret_value = fn(self, *arg, **kw)
[floatl] ^^^^^^^^^^^^^^^^^^^[8]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py », line 1257, in commit
self._prepare_impl()
File « », line 2, in _prepare_impl
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py », line 139, in _go
ret_value = fn(self, *arg, **kw)
[floatl] ^^^^^^^^^^^^^^^^^^^[9]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py », line 1232, in _prepare_impl
self.session.flush()
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py », line 4296, in flush
self._flush(objects)
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py », line 4431, in _flush
with util.safe_reraise():
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py », line 146, in exit
raise exc_value.with_traceback(exc_tb)
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py », line 4392, in _flush
flush_context.execute()
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/unitofwork.py », line 466, in execute
rec.execute(self)
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/unitofwork.py », line 642, in execute
util.preloaded.orm_persistence.save_obj(
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/persistence.py », line 93, in save_obj
_emit_insert_statements(
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/orm/persistence.py », line 1233, in _emit_insert_statements
result = connection.execute(
[floatl] ^^^^^^^^^^^^^^^^^^[10]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 1422, in execute
return meth(
[floatl] ^^^^[11]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py », line 514, in _execute_on_connection
return connection._execute_clauseelement(
[floatl] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[12]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 1644, in _execute_clauseelement
ret = self._execute_context(
[floatl] ^^^^^^^^^^^^^^^^^^^^^[13]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 1850, in _execute_context
return self._exec_single_context(
[floatl] ^^^^^^^^^^^^^^^^^^^^^^^^^[14]
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 1990, in _exec_single_context
self._handle_dbapi_exception(
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 2357, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py », line 1971, in _exec_single_context
self.dialect.do_execute(
File « /usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py », line 919, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column « change_id » of relation « schema_changes » violates not-null constraint
DETAIL: Failing row contains (null, 43, 2024-04-10 09:35:53.3733+00).
[SQL: INSERT INTO schema_changes (schema_version, changed) VALUES (%(schema_version)s, %(changed)s) RETURNING schema_changes.change_id]
[parameters: {‹ schema_version ›: 43, ‹ changed ›: datetime.datetime(2024, 4, 10, 9, 35, 53, 373300, tzinfo=datetime.timezone.utc)}]
(Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)
,
,
Je n’ai donc plus accès à l’historique et aucune donnée n’est enregistrée dans la DB.
Quelqu’un sait ce qui ne va pas ? Et ce qu’il faudrait faire pour résoudre ce problème ?
En attendant, je restaure ma sauvegarde…
Ma configuration
System Information
version | core-2024.4.2 |
---|---|
installation_type | Home Assistant OS |
dev | false |
hassio | true |
docker | true |
user | root |
virtualenv | false |
python_version | 3.12.2 |
os_name | Linux |
os_version | 6.1.73-haos-raspi |
arch | aarch64 |
timezone | Europe/Brussels |
config_dir | /config |
Home Assistant Community Store
GitHub API | ok |
---|---|
GitHub Content | ok |
GitHub Web | ok |
GitHub API Calls Remaining | 5000 |
Installed Version | 1.34.0 |
Stage | running |
Available Repositories | 1399 |
Downloaded Repositories | 12 |
HACS Data | ok |
Home Assistant Cloud
logged_in | false |
---|---|
can_reach_cert_server | ok |
can_reach_cloud_auth | ok |
can_reach_cloud | ok |
Home Assistant Supervisor
host_os | Home Assistant OS 12.1 |
---|---|
update_channel | stable |
supervisor_version | supervisor-2024.04.0 |
agent_version | 1.6.0 |
docker_version | 24.0.7 |
disk_total | 55.9 GB |
disk_used | 9.5 GB |
healthy | true |
supported | true |
board | rpi4-64 |
supervisor_api | ok |
version_api | ok |
installed_addons | Terminal & SSH (9.10.0), File editor (5.8.0), TimescaleDB (4.0.1), pgAdmin4 (3.0.1), Samba share (12.3.1), Advanced SSH & Web Terminal (17.2.0) |
Dashboards
dashboards | 4 |
---|---|
resources | 8 |
views | 3 |
mode | storage |
Recorder
error | failed to load: unknown |
---|