Skip to content

fix(desktop): auto-fallback to a free port (v2.2.2) - #45

Merged
gn00295120 merged 1 commit into
mainfrom
fix/desktop-auto-port
Jul 9, 2026
Merged

gn00295120 merged 1 commit into
mainfrom
fix/desktop-auto-port

Conversation

@gn00295120

Copy link
Copy Markdown
Member

The packaged desktop app hardwired port 3001 and showed a startup-error dialog (then quit) if anything else held it — e.g. an unrelated local MCP service. This makes it bind the first free port at/after the preferred one and load the window from that same port, so a busy 3001 is handled transparently.

  • electron/main.cjs: replaced the probePortInUse throw with a bind-based findAvailablePort(preferred); PORT/SERVER_URL resolved at startup and used consistently for the server spawn, waitForServer, and loadURL. STUDIO_PORT/PORT still set the preferred starting point.
  • Verified: with a port occupied, the finder skips to the next; when free, it uses the preferred.

304 tests, typecheck, format green. v2.2.2.

🤖 Generated with Claude Code

The packaged app hardwired port 3001 and refused to launch (startup-error
dialog) if anything else held it. Now main.cjs binds the first free port at or
after the preferred one (STUDIO_PORT/PORT, default 3001) and loads the window
from that same port, so a busy 3001 (e.g. another local MCP service) is handled
transparently. Replaces the probePortInUse throw with a bind-based finder.

v2.2.2.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gn00295120
gn00295120 merged commit a7ff636 into main Jul 9, 2026
3 checks passed
@gn00295120
gn00295120 deleted the fix/desktop-auto-port branch July 9, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant