SQLAlchemyError error processing task CommitTask()

I am running HAOS 17.2 with core 2026.4.4 on a yellow.

Recently it started giving the following error: SQLAlchemyError error processing task CommitTask() and around the same time AdGuard home stopped and tries to restart. In some cases it recovers in a few minutes and sometimes a manual restart is required. After this the issue can be gone for a day but in some cases it is back after a few minutes. A search online on this error pointed me towards a failing drive. I am also running scrutiny and it is indicating that my ssd is in perfect condition.

Full log:

 Logger: homeassistant.components.recorder.core
Bron: components/recorder/core.py:896
integratie: Recorder (documentatie, problemen)
Eerst voorgekomen: 16:10:56 (1 gebeurtenis)
Laatst gelogd: 16:10:56

SQLAlchemyError error processing task CommitTask()
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 896, in _process_one_task_or_event_or_recover
    task.run(self)
    ~~~~~~~~^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/tasks.py", line 297, in run
    instance._commit_event_session_or_retry()  # noqa: SLF001
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1192, in _commit_event_session_or_retry
    self._commit_event_session()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1218, in _commit_event_session
    session.execute(
    ~~~~~~~~~~~~~~~^
        update(States),
        ^^^^^^^^^^^^^^^
    ...<6 lines>...
        ],
        ^^
    )
    ^
  File "/usr/local/lib/python3.14/site-packages/sqlalchemy/orm/session.py", line 2365, in execute
    return self._execute_internal(
           ~~~~~~~~~~~~~~~~~~~~~~^
        statement,
        ^^^^^^^^^^
    ...<4 lines>...
        _add_event=_add_event,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.14/site-packages/sqlalchemy/orm/session.py", line 2251, in _execute_internal
    result: Result[Any] = compile_state_cls.orm_execute_statement(
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self,
        ^^^^^
    ...<4 lines>...
        conn,
        ^^^^^
    )
    ^
  File "/usr/local/lib/python3.14/site-packages/sqlalchemy/orm/bulk_persistence.py", line 1627, in orm_execute_statement
    result = _bulk_update(
        mapper,
    ...<8 lines>...
        enable_check_rowcount=enable_check_rowcount,
    )
  File "/usr/local/lib/python3.14/site-packages/sqlalchemy/orm/bulk_persistence.py", line 357, in _bulk_update
    persistence._emit_update_statements(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        base_mapper,
        ^^^^^^^^^^^^
    ...<6 lines>...
        enable_check_rowcount=enable_check_rowcount,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.14/site-packages/sqlalchemy/orm/persistence.py", line 912, in _emit_update_statements
    c = connection.execute(
        statement, multiparams, execution_options=execution_options
    )
  File "/usr/local/lib/python3.14/site-packages/sqlalchemy/engine/base.py", line 1415, in execute
    return meth(
        self,
        distilled_parameters,
        execution_options or NO_OPTIONS,
    )
  File "/usr/local/lib/python3.14/site-packages/sqlalchemy/sql/elements.py", line 523, in _execute_on_connection
    return connection._execute_clauseelement(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self, distilled_params, execution_options
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.14/site-packages/sqlalchemy/engine/base.py", line 1637, in _execute_clauseelement
    ret = self._execute_context(
        dialect,
    ...<8 lines>...
        cache_hit=cache_hit,
    )
  File "/usr/local/lib/python3.14/site-packages/sqlalchemy/engine/base.py", line 1809, in _execute_context
    conn = self._revalidate_connection()
  File "/usr/local/lib/python3.14/site-packages/sqlalchemy/engine/base.py", line 675, in _revalidate_connection
    self._invalid_transaction()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.14/site-packages/sqlalchemy/engine/base.py", line 665, in _invalid_transaction
    raise exc.PendingRollbackError(
    ...<4 lines>...
    )
sqlalchemy.exc.PendingRollbackError: Can't reconnect until invalid transaction is rolled back.  Please rollback() fully before proceeding (Background on this error at: https://sqlalche.me/e/20/8s2b)

MariaDB log:


Version: '11.4.10-MariaDB'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Alpine Linux
[21:48:03] INFO: Service mariadb exited with code 256 (by signal 9)
[21:48:05] INFO: Starting MariaDB
2026-05-07 21:48:05 0 [Note] Starting MariaDB 11.4.10-MariaDB source revision 054a893f1645b77e52a329a7fc8cf614eebd1fad server_uid hYiKzQ0hlS9hDmnP9IUWkX4QjYI= as process 1994
2026-05-07 21:48:05 0 [Note] InnoDB: Compressed tables use zlib 1.3.2
2026-05-07 21:48:05 0 [Note] InnoDB: Number of transaction pools: 1
2026-05-07 21:48:05 0 [Note] InnoDB: Using ARMv8 crc32 instructions
2026-05-07 21:48:05 0 [Note] InnoDB: Using Linux native AIO
2026-05-07 21:48:05 0 [Note] InnoDB: innodb_buffer_pool_size_max=128m, innodb_buffer_pool_size=128m
2026-05-07 21:48:05 0 [Note] InnoDB: Completed initialization of buffer pool
2026-05-07 21:48:05 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
2026-05-07 21:48:05 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=337758249439
2026-05-07 21:48:05 0 [Note] InnoDB: End of log at LSN=337767265593
2026-05-07 21:48:05 0 [Note] InnoDB: To recover: 1073 pages
2026-05-07 21:48:05 0 [Note] InnoDB: Opened 3 undo tablespaces
2026-05-07 21:48:05 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
2026-05-07 21:48:05 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
2026-05-07 21:48:05 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2026-05-07 21:48:05 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2026-05-07 21:48:05 0 [Note] InnoDB: log sequence number 337767265593; transaction id 30786854
2026-05-07 21:48:05 0 [Note] Plugin 'FEEDBACK' is disabled.
2026-05-07 21:48:05 0 [Note] Plugin 'wsrep-provider' is disabled.
2026-05-07 21:48:05 0 [Note] InnoDB: Loading buffer pool(s) from /data/databases/ib_buffer_pool
2026-05-07 21:48:05 0 [Note] Recovering after a crash using tc.log
2026-05-07 21:48:05 0 [Note] Starting table crash recovery...
2026-05-07 21:48:05 0 [Note] Crash table recovery finished.
2026-05-07 21:48:05 0 [Note] InnoDB: Buffer pool(s) load completed at 260507 21:48:05
2026-05-07 21:48:09 0 [Note] Server socket created on IP: '0.0.0.0', port: '3306'.
2026-05-07 21:48:09 0 [Note] Server socket created on IP: '::', port: '3306'.
2026-05-07 21:48:09 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
2026-05-07 21:48:09 0 [Note] mariadbd: ready for connections.
Version: '11.4.10-MariaDB'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Alpine Linux
[22:04:07] INFO: Service mariadb exited with code 256 (by signal 9)
[22:04:09] INFO: Starting MariaDB
2026-05-07 22:04:09 0 [Note] Starting MariaDB 11.4.10-MariaDB source revision 054a893f1645b77e52a329a7fc8cf614eebd1fad server_uid hYiKzQ0hlS9hDmnP9IUWkX4QjYI= as process 2036
2026-05-07 22:04:09 0 [Note] InnoDB: Compressed tables use zlib 1.3.2
2026-05-07 22:04:09 0 [Note] InnoDB: Number of transaction pools: 1
2026-05-07 22:04:09 0 [Note] InnoDB: Using ARMv8 crc32 instructions
2026-05-07 22:04:09 0 [Note] InnoDB: Using Linux native AIO
2026-05-07 22:04:09 0 [Note] InnoDB: innodb_buffer_pool_size_max=128m, innodb_buffer_pool_size=128m
2026-05-07 22:04:09 0 [Note] InnoDB: Completed initialization of buffer pool
2026-05-07 22:04:09 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
2026-05-07 22:04:09 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=337762831169
2026-05-07 22:04:09 0 [Note] InnoDB: End of log at LSN=337768732813
2026-05-07 22:04:09 0 [Note] InnoDB: To recover: 964 pages
2026-05-07 22:04:10 0 [Note] InnoDB: 1 transaction(s) which must be rolled back or cleaned up in total 1 row operations to undo
2026-05-07 22:04:10 0 [Note] InnoDB: Trx id counter is 30787263
2026-05-07 22:04:10 0 [Note] InnoDB: Opened 3 undo tablespaces
2026-05-07 22:04:10 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
2026-05-07 22:04:10 0 [Note] InnoDB: Starting in background the rollback of recovered transactions
2026-05-07 22:04:10 0 [Note] InnoDB: Rolled back recovered transaction 30787261
2026-05-07 22:04:10 0 [Note] InnoDB: Rollback of non-prepared transactions completed
2026-05-07 22:04:10 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
2026-05-07 22:04:10 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2026-05-07 22:04:10 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2026-05-07 22:04:10 0 [Note] InnoDB: log sequence number 337768732813; transaction id 30787265
2026-05-07 22:04:10 0 [Note] InnoDB: Loading buffer pool(s) from /data/databases/ib_buffer_pool
2026-05-07 22:04:10 0 [Note] Plugin 'FEEDBACK' is disabled.
2026-05-07 22:04:10 0 [Note] Plugin 'wsrep-provider' is disabled.
2026-05-07 22:04:10 0 [Note] Recovering after a crash using tc.log
2026-05-07 22:04:10 0 [Note] Starting table crash recovery...
2026-05-07 22:04:10 0 [Note] Crash table recovery finished.
2026-05-07 22:04:10 0 [Note] InnoDB: Buffer pool(s) load completed at 260507 22:04:10
2026-05-07 22:04:24 0 [Note] Server socket created on IP: '0.0.0.0', port: '3306'.
2026-05-07 22:04:24 0 [Note] Server socket created on IP: '::', port: '3306'.
2026-05-07 22:04:24 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
2026-05-07 22:04:24 0 [Note] mariadbd: ready for connections.

I do not know what the next best step is to solve this.