Skip to content

GUI: fix dev-server port-retry crash under Express 5 - #3482

Merged
jelveh merged 1 commit into
mainfrom
fix/dev-server-express5-listen
Jul 31, 2026
Merged

GUI: fix dev-server port-retry crash under Express 5#3482
jelveh merged 1 commit into
mainfrom
fix/dev-server-express5-listen

Conversation

@jelveh

@jelveh jelveh commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Express 5's app.listen wraps the listen callback in once() and also invokes it on 'error', with the error as the first argument — at which point server.address() is null, so the startup log threw a TypeError and killed the process before the EADDRINUSE handler could try the next port. Bail out of the callback when it receives an error and let the 'error' listener own the retry.

Verified: with 4000 occupied the server now logs the retry and comes up on 4001; with the port free it binds 4000 as before.

Express 5's app.listen wraps the listen callback in once() and also
invokes it on 'error', with the error as the first argument — at which
point server.address() is null, so the startup log threw a TypeError
and killed the process before the EADDRINUSE handler could try the
next port. Bail out of the callback when it receives an error and let
the 'error' listener own the retry.

Verified: with 4000 occupied the server now logs the retry and comes
up on 4001; with the port free it binds 4000 as before.
@jelveh
jelveh merged commit f1bc065 into main Jul 31, 2026
1 check passed
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