🛠️ Rocket.Chat Fails Due to TCP Broker Port Conflict (EADDRINUSE on :::41403) — FIXED
❗ The Problem
After restoring a Rocket.Chat instance via mongorestore (including rocketchat_apps collection), and running it behind Docker + Traefik, the platform appeared to start fine, but the logs were filled with:
ERROR .../TRANSPORTER: Server error. Error: listen EADDRINUSE: address already in use :::41403
This caused:
- App Engine Deno subprocesses to fail.
- Rocket.Chat UI to partially load (but no app could be loaded).
- Broker reconnection attempts every 5 seconds.
- No listening process actually bound to port 41403 inside the container.
🧪 What Was Tried (and Failed)
- Setting sysctl
net.ipv6.conf.all.disable_ipv6=1 inside the container.
- Verifying exposed ports using
ss, netstat, etc. — no explicit conflict.
- Explicitly setting
BROKER_TRANSPORTER and ROCKETCHAT_APPS_ENGINE_BROKER_TRANSPORTER to different loopback addresses/ports.
- No known issue from Traefik side (proxy working perfectly).
Nothing helped.
✅ The Actual Root Cause & Fix
Turns out the issue was that two Rocket.Chat apps were already marked as manually_enabled in the DB, and both attempted to spin up their own Moleculer broker, causing an internal port collision on ::41403.
💥 Fix (run inside Mongo shell):
use rocketchat
db.rocketchat_apps.updateMany({}, { $set: { status: 'disabled' } })
🌀 After restarting the container, the broker booted cleanly, no more EADDRINUSE, and apps could be re-enabled one by one via the UI or DB.
🧰 Config Reference (doesn’t help alone!)
⚠️ These env vars alone didn’t solve anything unless the DB apps were disabled.
rocketchat:
image: rocketchat/rocket.chat:latest
environment:
BROKER_TRANSPORTER: tcp://0.0.0.0:42000
ROCKETCHAT_APPS_ENGINE_BROKER_TRANSPORTER: tcp://127.0.0.1:42000
sysctls:
- net.ipv6.conf.all.disable_ipv6=1
💡 Suggestions
-
Rocket.Chat should check for multiple apps trying to bind the same broker port.
-
Perhaps include a startup flag like:
DISABLE_ALL_APPS_ON_BOOT=true
…to prevent these port conflicts after database restores or migrations.
-
At the very least, if EADDRINUSE is detected, auto-disable the crashing app with an informative log.
💬 Hope this helps someone who is restoring or migrating Rocket.Chat and hitting this obscure bug.
Let me know if logs or further context are useful!
🛠️ Rocket.Chat Fails Due to TCP Broker Port Conflict (
EADDRINUSEon :::41403) — FIXED❗ The Problem
After restoring a Rocket.Chat instance via
mongorestore(includingrocketchat_appscollection), and running it behind Docker + Traefik, the platform appeared to start fine, but the logs were filled with:This caused:
🧪 What Was Tried (and Failed)
net.ipv6.conf.all.disable_ipv6=1inside the container.ss,netstat, etc. — no explicit conflict.BROKER_TRANSPORTERandROCKETCHAT_APPS_ENGINE_BROKER_TRANSPORTERto different loopback addresses/ports.Nothing helped.
✅ The Actual Root Cause & Fix
Turns out the issue was that two Rocket.Chat apps were already marked as
manually_enabledin the DB, and both attempted to spin up their own Moleculer broker, causing an internal port collision on::41403.💥 Fix (run inside Mongo shell):
🌀 After restarting the container, the broker booted cleanly, no more
EADDRINUSE, and apps could be re-enabled one by one via the UI or DB.🧰 Config Reference (doesn’t help alone!)
💡 Suggestions
Rocket.Chat should check for multiple apps trying to bind the same broker port.
Perhaps include a startup flag like:
…to prevent these port conflicts after database restores or migrations.
At the very least, if
EADDRINUSEis detected, auto-disable the crashing app with an informative log.💬 Hope this helps someone who is restoring or migrating Rocket.Chat and hitting this obscure bug.
Let me know if logs or further context are useful!