pbakaus/impeccable · error

Live server already running on port {port} (pid {pid}).

Error message

Live server already running on port {port} (pid {pid}).

What it means

When starting the live server, the command checks for an existing session info file. If one exists with a recorded port and pid, it refuses to start a second server, prints the existing port and pid, and exits 1. This guards against two live servers fighting over the same workspace.

Source

Thrown at crates/live/src/live_server.rs:137

    // Check for existing session
    if let Some((existing, path)) = read_live_server_info(&cwd, &env) {
        let alive = existing
            .pid
            .map(|p| crate::util::kill0(p).is_ok())
            .unwrap_or(false);
        if alive {
            let port = existing
                .raw
                .get("port")
                .map(js_display)
                .unwrap_or_else(|| "undefined".to_string());
            let pid = existing
                .raw
                .get("pid")
                .map(js_display)
                .unwrap_or_else(|| "undefined".to_string());
            io.err(&format!(
                "Live server already running on port {} (pid {}).\n",
                port, pid
            ));
            let self_cmd = impeccable_context::provider::detect(&env, &cwd).self_cmd;
            io.err(&format!(
                "Stop it first with: {} live-server stop\n",
                self_cmd
            ));
            return 1;
        }
        let _ = std::fs::remove_file(&path);
    }

    let token = random_uuid();
    let store = create_live_session_store(&cwd, &env, None);
    let (log_tx, log_rx) = channel::<(bool, String)>();
    let debug_events = env
        .get("IMPECCABLE_LIVE_DEBUG_EVENTS")

View on GitHub (pinned to 2bc2879276)

Solutions

  1. If the existing server is valid, use it instead of starting a new one.
  2. Stop the existing server first with `<self_cmd> live-server stop` (printed alongside this error), then start again.
  3. If the pid in the message is dead, delete the stale server info file manually and re-run the start command.

Example fix

// before
$ ./scripts/impeccable live
Live server already running on port 8400 (pid 4242).
// after
$ <self_cmd> live-server stop
$ ./scripts/impeccable live
Defensive patterns

Strategy: fallback

Validate before calling

// shell: reuse the running server instead of starting a duplicate
if [ -f .impeccable/live-server.json ] && kill -0 "$(jq -r .pid .impeccable/live-server.json)" 2>/dev/null; then
  echo 'server already running; reusing it'
else
  ./scripts/impeccable live
fi

Prevention

When it happens

Trigger: Running the `live` start command when an existing server info file is found containing `port` and `pid` values — i.e. a live server is (or was) already registered for this workspace.

Common situations: A previous live server is genuinely still running and a duplicate start was attempted; a server crashed leaving a stale info file that still looks valid; two agents or shells in the same directory both trying to start live mode; resuming after a reboot where the pid is dead but the file remains.

Related errors


AI-assisted analysis of pbakaus/impeccable@2bc2879276 (2026-09-08). Data as JSON: /api/errors/484a89e4a9e36ddd. Report an issue: GitHub.