Skip to content

Coordinated fallback when the server port is unavailable (Windows port reservations) #1594

Backlog

Description

@scottsgevor

Pre-submission checklist

Note: this repo routes feature requests to the forum (https://forum.activitywatch.net/c/features). I opened this as an issue because it is a cross-repo design question tied to two ready PRs; happy to move it to the forum if maintainers prefer.

Issue

Summary

On Windows, Hyper-V/WSL (WinNAT) can reserve ranges of TCP ports from the dynamic pool. If the range includes 5600, ActivityWatch dies silently: aw-server exits while binding (WinError 10013, see #571), watchers keep queueing, the dashboard is unreachable, and the tray only says "crashed". The manual workaround is to stop winnat, reserve 5600 as an administered exclusion, and restart winnat.

Two diagnostics PRs make that failure visible:

Proposal

A coordinated fallback (prompted or opt-in), orchestrated by aw-qt because it is the only component that knows all the modules:

  1. Detect that the configured server port is unavailable (before start, or on first crash).
  2. Ask the user: keep the current setup (with the OS-level fix) or switch to another port.
  3. On "switch": update the server config (aw-server.toml / aw-server-rust config.toml) and the shared aw-client.toml, restart the server and watchers, and point the dashboard at the new port.
  4. Document the implications for external integrations.

Why not let aw-server pick a random free port?

The port is part of a cross-component contract: aw-client-based watchers read aw-client.toml, aw-qt's health check uses the configured port, and the browser watcher's manifest only allows http://127.0.0.1:5600/api/*. A server-only fallback would keep running with nothing sending data — a silent failure that is worse than the current loud one.

Open questions

  • Default behavior: prompt, an opt-in setting, or always keep 5600 and show the OS-level fix?
  • Should aw-watcher-web support a configurable port (manifest + settings) before this is viable?
  • Where should the Windows netsh workaround be documented (docs repo)?

Activity

  1. github-actions commented on Dec 2, 2026

    @github-actions

    Hi there!
    As you're new to this repo, please make sure you've used an appropriate issue template and searched for duplicates (it helps us focus on actual development!). We'd also like to suggest that you read our contribution guidelines and our code of conduct.
    Thanks a bunch for opening your first issue! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions