You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: A server bound to a specific address leaves port 3773 when another process holds 127.0.0.1:3773 #41729
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
Run anything that listens on 127.0.0.1:3773, for example the T3 Code desktop app.
Run t3 serve --host <this machine's Tailscale IP> with no --port and no T3CODE_PORT.
Read the Listening on line. Restart it and read the line again.
Expected behavior
The server binds <tailscale-ip>:3773. That address and port are free: an explicit --port 3773 binds them with no error.
Actual behavior
The server picks a random port, and a different one on each restart. Windows 11, installed 0.1.12-nightly.20261123.5151, fresh T3CODE_HOME, the desktop app holding 127.0.0.1:3773:
Command
Bound
serve --host 100.x.y.z
100.x.y.z:59939, then 100.x.y.z:60033 after a restart
serve --host 100.x.y.z --port 3773
100.x.y.z:3773
serve --host 192.168.x.y
192.168.x.y:56210
serve --host 0.0.0.0
0.0.0.0:49603 (correct: localhost clients would reach the other process)
serve (no host)
127.0.0.1:56231 (correct)
The same happens on Linux: a user systemd service with T3CODE_HOST=<tailscale-ip>, on a host where another user's T3 Code holds 127.0.0.1:3773, came back on a random port after an update restart.
Cause: resolveServerConfig (apps/server/src/cli/config.ts) picks the port before it resolves the bind host, and NetService.findAvailablePort (packages/shared/src/Net.ts) probes only 127.0.0.1 and ::1. That probe is right for the default loopback bind and for wildcard binds, and wrong for a specific address. The WSL branch in apps/server/src/cli/automaticPort.ts has the same blind spot.
A client saved with a direct route (http://<tailscale-ip>:3773) cannot reach the server after the restart, and it cannot learn the new port, because the server advertises its endpoints only to clients that are already connected.
Impact
Major degradation or frequent failure
Version or commit
main at 7872c23; installed nightly 0.1.12-nightly.20261123.5151
Environment
Windows 11 (table above); Linux user systemd service
Logs or stack traces
No response
Screenshots, recordings, or supporting files
No response
Workaround
Set T3CODE_PORT=3773 in service.env, or pass --port 3773.
Activity