MariaDB Upgrade 11 - Setup failed for recorder: Integration failed to initialize

Good Morning,

I’m running HomeAssistant (2023.2.4) on a Raspberry Pi 4 as Docker container + a central MariaDB instance on an Ubuntu server, also as Docker container. All was working fine and as expected the last months.

This morning, I noticed this error : “Setup failed for recorder: Integration failed to initialize.” (+ a lot of follow up errors).

Error during connection setup: [<class ‘decimal.ConversionSyntax’>] (retrying in 3 seconds)

'File “/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/base.py”, line 2499, in _get_server_version_info
cursor.execute(“SELECT VERSION()”)

When calling “SELECT VERSION()” in phpMyAdmin, I receive: “11.0.2-MariaDB-1:11.0.2+maria~ubu2204”

The database has been created as utf8mb4_unicode_ci.

I added the complete log below.

I assume the error has been introduced during an automated Docker image upgrade to MariaDB 11.0, since it was all working fine with the latest image 10.6.
What would be the appropriate way to check and fix this error ?

Kind regards,


2023-06-10 04:45:10.208 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: [<class 'decimal.ConversionSyntax'>]
2023-06-10 04:45:10.212 ERROR (Recorder) [homeassistant.components.recorder.core] Error while processing event StatisticsTask(start=datetime.datetime(2023, 6, 10, 2, 40, tzinfo=datetime.timezone.utc), fire_events=True): [<class 'decimal.ConversionSyntax'>]
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 671, in _run_event_loop
    self._process_one_task_or_recover(task)
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 684, in _process_one_task_or_recover
    return task.run(self)
  File "/usr/src/homeassistant/homeassistant/components/recorder/tasks.py", line 143, in run
    if statistics.compile_statistics(instance, self.start, self.fire_events):
  File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 600, in wrapper
    return job(instance, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 701, in compile_statistics
    compiled: PlatformCompiledStatistics = platform.compile_statistics(
  File "/usr/src/homeassistant/homeassistant/components/sensor/recorder.py", line 382, in compile_statistics
    compiled = _compile_statistics(hass, session, start, end)
  File "/usr/src/homeassistant/homeassistant/components/sensor/recorder.py", line 397, in _compile_statistics
    old_metadatas = statistics.get_metadata_with_session(
  File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 847, in get_metadata_with_session
    result = execute_stmt_lambda_element(session, stmt)
  File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 217, in execute_stmt_lambda_element
    executed = session.execute(stmt)
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1714, in execute
    result = conn._execute_20(statement, params or {}, execution_options)
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1705, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/lambdas.py", line 516, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1572, in _execute_clauseelement
    ret = self._execute_context(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context
    self._handle_dbapi_exception(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2128, in _handle_dbapi_exception
    util.raise_(exc_info[1], with_traceback=exc_info[2])
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/local/lib/python3.10/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.10/site-packages/MySQLdb/cursors.py", line 321, in _query
    self._post_get_result()
  File "/usr/local/lib/python3.10/site-packages/MySQLdb/cursors.py", line 355, in _post_get_result
    self._rows = self._fetch_row(0)
  File "/usr/local/lib/python3.10/site-packages/MySQLdb/cursors.py", line 328, in _fetch_row
    return self._result.fetch_row(size, self._fetch_type)
decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]

Please ignore, error got resolved upon upgrading to 202306… all fine… thanks!

1 Like

Nevertheless, pretty ballsy to auto-update your mysql container (or any container, really) :wink:

1 Like