pbakaus/impeccable · error

Live server not running. Start one with

Error message

Live server not running. Start one with: {}

What it means

live-poll tried to contact the local live-mode server's HTTP endpoint and got a connection-refused error (PollError::ConnRefused), meaning nothing is listening on the expected port. The CLI prints instructions with the exact command to start the server (`script_cmd(&env, &cwd, "live")`) and exits 1.

Solutions

  1. Start the live server using the command shown in the error message (the printed `live` script command) and retry the poll.
  2. Verify the server is actually listening (check its process/log and the port) and that your --base URL/port matches it.
  3. If the server crashed, inspect its logs, fix the startup failure, and restart before polling again.

Example fix

// before (server not started)
$ impeccable live-poll --base http://127.0.0.1:9 khu
// Live server not running. Start one with: ...
// after
$ <live start command from the error message>
$ impeccable live-poll --base http://127.0.0.1:9 khu
Defensive patterns

Strategy: retry

Validate before calling

// Check the server is up before polling:
const res = await fetch(base + '/health').catch(() => null);
if (!res || !res.ok) console.error('Live server not running; start it first.');

Try / catch

try {
  runLivePoll();
} catch (e) {
  if (e.code === 'ECONNREFUSED') {
    startLiveServer(); // then retry with backoff
    await waitForPort(base);
    runLivePoll();
  } else throw e;
}

Prevention

When it happens

Trigger: Running a live poll/ack command (e.g. `impeccable live-poll ...`) in a terminal before the live server process has been started, after the server crashed or exited, or when the server is running on a different port/base URL than the one `--base` (or default) points to.

Common situations: Fresh clone/first run where the live server was never started; server killed between sessions; port mismatch after changing config; firewall/sandbox blocking localhost connections.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of pbakaus/impeccable@f2c7051853 (2026-09-16). Data as JSON: /api/errors/728ddc8b0df65158. Report an issue: GitHub.

Appendix: source

Thrown at crates/live/src/live_poll.rs:750

            Err(msg) => {
                io.err(&format!("{}\n", msg));
                return 1;
            }
        };
        let then_poll = argv.iter().any(|a| a == "--then-poll");
        return match post_reply(&base, &token, &reply) {
            Ok(()) => {
                let ack = reply_ack_json(&reply);
                if then_poll {
                    // One round trip instead of two: the reply is in, so wait
                    // for what the browser does next (usually the accept).
                    return one_shot_poll(&argv, &base, &token, Some(ack), io);
                }
                println(io, &serde_json::to_string(&ack).unwrap_or_default());
                0
            }
            Err(PollError::ConnRefused) => {
                io.err(&format!(
                    "Live server not running. Start one with: {}\n",
                    script_cmd(&env, &cwd, "live")
                ));
                1
            }
            Err(PollError::Auth) => {
                // JS: a 401 on the reply POST is a non-ok response -> "Reply failed: <body.error>"
                io.err("Reply failed: Unauthorized\n");
                1
            }
            Err(PollError::AckTimeout(m)) | Err(PollError::Other(m)) => {
                io.err(&format!("Reply failed: {}\n", m));
                1
            }
        };
    }

    let stream_mode = argv.iter().any(|a| a == "--stream");

View on GitHub (pinned to f2c7051853)