Unhealthy container - but why?

Hi,
I have Home Assistant running on my Synology DS720+ in Docker. Everything works fine, but in Portainer I see that Home Assistant is marked as unhealthy.

Log:

  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 368, in report_non_thread_safe_operation
    report(
    ~~~~~~^
        f"calls {what} from a thread other than the event loop, "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
        error_if_integration=True,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 164, in report
    report_usage(
    ~~~~~~~~~~~~^
        what,
        ^^^^^
    ...<4 lines>...
        level=level,
        ^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 242, in report_usage
    _report_integration_frame(
    ~~~~~~~~~~~~~~~~~~~~~~~~~^
        what,
        ^^^^^
    ...<3 lines>...
        integration_behavior is ReportBehavior.ERROR,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 340, in _report_integration_frame
    raise RuntimeError(
    ...<5 lines>...
    )
RuntimeError: Detected that custom integration 'hass_agent' calls device_registry.async_update_device from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#device_registryasync_update_device at custom_components/hass_agent/__init__.py, line 29: device_registry.async_get_or_create(. Please report it to the author of the 'hass_agent' custom integration
2025-01-28 10:28:26.761 WARNING (SyncWorker_4) [homeassistant.helpers.frame] Detected that custom integration 'hass_agent' calls device_registry.async_update_device from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#device_registryasync_update_device at custom_components/hass_agent/__init__.py, line 29: device_registry.async_get_or_create(. Please report it to the author of the 'hass_agent' custom integration
2025-01-28 10:28:26.767 ERROR (SyncWorker_4) [homeassistant.util.logging] Exception in updated when handling msg on 'hass.agent/devices/DESKTOP-M45V1T8-saschawin11': '{"serial_number":"60a23122-416e-429c-a55e-e55d5981612f","device":{"identifiers":"hass.agent-DESKTOP-M45V1T8-saschawin11","manufacturer":"HASS.Agent Team","model":"Microsoft Windows NT 10.0.26100.0","name":"DESKTOP-M45V1T8-saschawin11","sw_version":"2.1.0"},"apis":{"notifications":true,"media_player":true}}'
Traceback (most recent call last):
  File "/config/custom_components/hass_agent/__init__.py", line 144, in updated
    update_device_info(hass, entry, payload)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hass_agent/__init__.py", line 29, in update_device_info
    device_registry.async_get_or_create(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        config_entry_id=entry.entry_id,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<4 lines>...
        sw_version=new_device_info["device"]["sw_version"],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 822, in async_get_or_create
    device = self.async_update_device(
        device.id,
    ...<16 lines>...
        via_device_id=via_device_id,
    )
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 1037, in async_update_device
    self.hass.verify_event_loop_thread("device_registry.async_update_device")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 465, in verify_event_loop_thread
    frame.report_non_thread_safe_operation(what)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 368, in report_non_thread_safe_operation
    report(
    ~~~~~~^
        f"calls {what} from a thread other than the event loop, "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
        error_if_integration=True,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 164, in report
    report_usage(
    ~~~~~~~~~~~~^
        what,
        ^^^^^
    ...<4 lines>...
        level=level,
        ^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 242, in report_usage
    _report_integration_frame(
    ~~~~~~~~~~~~~~~~~~~~~~~~~^
        what,
        ^^^^^
    ...<3 lines>...
        integration_behavior is ReportBehavior.ERROR,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 340, in _report_integration_frame
    raise RuntimeError(
    ...<5 lines>...
    )
RuntimeError: Detected that custom integration 'hass_agent' calls device_registry.async_update_device from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#device_registryasync_update_device at custom_components/hass_agent/__init__.py, line 29: device_registry.async_get_or_create(. Please report it to the author of the 'hass_agent' custom integration

I have added Home assistant as a stack in Portainer and this is the code:

version: "3.9"
services:
  homeassistant:
    image: homeassistant/home-assistant
    container_name: Home-Assistant
    mem_limit: 8g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    healthcheck:
     test: curl -f http://localhost:8124/ || exit 1
    restart: on-failure:5
    network_mode: host
    volumes:
      - /volume1/docker/homeassistant:/config:rw
    environment:
      TZ: Europe/Berlin

If I want to access the web interface, I go to it with NAS-IP:8123/lovelace/0

I can’t find the error. It’s probably so simple that I’m overlooking it. :wink:

Thanks

//edit: I fixed it.

wrong:
test: curl -f http://localhost:8124/ || exit 1

right:
test: curl -f http://localhost:8123/ || exit 1