EADDRINUSE on a port you just migrated off of — an old systemd service came back
Error: listen EADDRINUSE: address already in use 0.0.0.0:<port>
(new service fails to start, or restart-loops)What's happening
After retiring an old service in favor of a replacement bound to the same port, simply running `systemctl stop` on the old one isn't enough if it's still `enabled` — a reboot, a parallel deploy, or anyone running `systemctl start <old-service>` 'just to check something' brings it right back, and it silently grabs the port before the new service gets a chance to bind. The new service then fails with EADDRINUSE and often restart-loops, while the actual cause — a zombie process from a service nobody remembers exists anymore — stays invisible unless you specifically go looking for it.
Fix
1. Identify what's actually holding the port: `ss -tlnp | grep <port>` shows the PID and process name. 2. Stop it and, critically, disable it so it can't come back on boot: `systemctl stop <old-service> && systemctl disable <old-service>`. 3. Confirm the new service now binds cleanly: `systemctl restart <new-service> && ss -tlnp | grep <port>`. 4. If it keeps coming back, search systemd journals and any deploy/migration/rollback scripts for anything that calls `systemctl start <old-service>`. 5. Once you're confident the old service is permanently retired, consider removing its unit file entirely rather than leaving it disabled-but-present — that eliminates the whole class of 'someone restarts it by habit' risk for good.
Got a different error? Paste it here for a free diagnosis.