Skip to content

[Bug Report]: Music Assistant app in network mode "host" crashes on startup #3609

Description

@Grishnackh

App Name

music-assistant

Version (TrueNAS Catalog App Version)

2.6.2

App Issue

At first: thank you very much for adding Music Assistant as a TrueNAS Scale app in #1207, @stavros-k!

Unfortunately the app doesn't start when "host network" is activated under the network settings. The host network is recommended for Music Assistant, see https://www.music-assistant.io/installation/#docker-image. Otherwise some devices are not properly discovered through the UPnP protocol.

The reason for crashing is apparently that the container tries to start a mDNS service on port 5353. The same port is used by TrueNAS scale itself for the avahi-daemon already.

Maybe the port binding issue can be solved by using a macvlan as described for example in this blog post: https://technotim.live/posts/truenas-docker-pro/#why-macvlan

App Logs

2025-11-13 23:29:40.843 ERROR (MainThread) [root] Uncaught exception
Traceback (most recent call last):
  File "/app/venv/bin/mass", line 10, in <module>
    sys.exit(main())
             ~~~~^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/__main__.py", line 238, in main
    run(
    ~~~^
        start_mass(),
        ^^^^^^^^^^^^^
        shutdown_callback=on_shutdown,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        executor_workers=16,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/app/venv/lib/python3.13/site-packages/aiorun/__init__.py", line 374, in run
    raise pending_exception_to_raise
  File "/app/venv/lib/python3.13/site-packages/aiorun/__init__.py", line 276, in run
    shutdown_callback(loop)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/__main__.py", line 223, in on_shutdown
    loop.run_until_complete(mass.stop())
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/mass.py", line 205, in stop
    await self.streams.close()
          ^^^^^^^^^^^^
AttributeError: 'MusicAssistant' object has no attribute 'streams'
2025-11-13 23:30:42.040 ERROR (MainThread) [zeroconf] Address in use when binding to ('', 5353); When using avahi, make sure disallow-other-stacks is set to no in avahi-daemon.conf
2025-11-13 23:30:42.040 ERROR (MainThread) [music_assistant] Error doing task: Task exception was never retrieved
Traceback (most recent call last):
  File "/app/venv/lib/python3.13/site-packages/aiorun/__init__.py", line 223, in new_coro
    await coro
  File "/app/venv/lib/python3.13/site-packages/music_assistant/__main__.py", line 232, in start_mass
    await mass.start()
  File "/app/venv/lib/python3.13/site-packages/music_assistant/mass.py", line 138, in start
    self.aiozc = AsyncZeroconf(ip_version=IPVersion.V4Only, interfaces=InterfaceChoice.Default)
                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/zeroconf/asyncio.py", line 171, in __init__
    self.zeroconf = zc or Zeroconf(
                          ~~~~~~~~^
        interfaces=interfaces,
        ^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        apple_p2p=apple_p2p,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/app/venv/lib/python3.13/site-packages/zeroconf/_core.py", line 181, in __init__
    listen_socket, respond_sockets = create_sockets(interfaces, unicast, ip_version, apple_p2p=apple_p2p)
                                     ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/zeroconf/_utils/net.py", line 451, in create_sockets
    listen_socket = new_socket(bind_addr=("",), ip_version=ip_version, apple_p2p=apple_p2p)
  File "/app/venv/lib/python3.13/site-packages/zeroconf/_utils/net.py", line 291, in new_socket
    s.bind(bind_tup)
    ~~~~~~^^^^^^^^^^
OSError: [Errno 98] Address in use
2025-11-13 23:30:42.044 INFO (MainThread) [aiorun] Entering shutdown phase.
2025-11-13 23:30:42.044 INFO (MainThread) [aiorun] Executing provided shutdown_callback.
2025-11-13 23:30:42.044 INFO (MainThread) [root] shutdown requested!
2025-11-13 23:30:42.044 INFO (MainThread) [music_assistant] Stop called, cleaning up...
2025-11-13 23:30:42.045 INFO (MainThread) [aiorun] Waiting for executor shutdown.
2025-11-13 23:30:42.046 INFO (MainThread) [aiorun] Shutting down async generators
2025-11-13 23:30:42.046 INFO (MainThread) [aiorun] Closing the loop.
2025-11-13 23:30:42.046 INFO (MainThread) [aiorun] Leaving. Bye!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions