Skip to content

fix(webui): handle EADDRINUSE when starting server in WebUI mode#1733

Merged
piorpua merged 1 commit intomainfrom
fix/sentry-ELECTRON-N
Mar 26, 2026
Merged

fix(webui): handle EADDRINUSE when starting server in WebUI mode#1733
piorpua merged 1 commit intomainfrom
fix/sentry-ELECTRON-N

Conversation

@kaizhou-lab
Copy link
Copy Markdown
Collaborator

Summary

  • Wrap startWebServer() in try-catch in the main entry point (src/index.ts)
  • Log error and exit gracefully with app.exit(1) when port is occupied
  • Other callers (webuiBridge, webuiConfig, server.ts) already had error handling

Sentry: ELECTRON-N — 1,933 events

Closes #1732

Verification

  • Process: main (Electron app init) — deeply coupled to Electron lifecycle, not unit-testable
  • The fix is a defensive try-catch wrapper; all other callers follow the same pattern
  • Type check and lint pass

Test plan

  • bunx tsc --noEmit passes
  • Lint and format clean
  • Manual: start two AionUi instances in WebUI mode on same port → second should log error and exit cleanly

Wrap startWebServer() in try-catch in the main entry point to prevent
unhandled promise rejection when the port is already in use
(Sentry ELECTRON-N, 1.9k events). Log the error and exit gracefully.

Fixes ELECTRON-N
@kaizhou-lab kaizhou-lab marked this pull request as ready for review March 26, 2026 03:41
@piorpua piorpua merged commit d04e939 into main Mar 26, 2026
17 checks passed
@piorpua piorpua deleted the fix/sentry-ELECTRON-N branch March 26, 2026 04:01
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.

fix: handle EADDRINUSE in WebUI startup (ELECTRON-N)

2 participants