{"record":{"id":"484a89e4a9e36ddd","repo":"pbakaus/impeccable","slug":"live-server-already-running-on-port-port-pid-p","errorCode":null,"errorMessage":"Live server already running on port {port} (pid {pid}).\n","messagePattern":"Live server already running on port (.+?) \\(pid (.+?)\\)\\.\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/live/src/live_server.rs","lineNumber":137,"sourceCode":"\n    // Check for existing session\n    if let Some((existing, path)) = read_live_server_info(&cwd, &env) {\n        let alive = existing\n            .pid\n            .map(|p| crate::util::kill0(p).is_ok())\n            .unwrap_or(false);\n        if alive {\n            let port = existing\n                .raw\n                .get(\"port\")\n                .map(js_display)\n                .unwrap_or_else(|| \"undefined\".to_string());\n            let pid = existing\n                .raw\n                .get(\"pid\")\n                .map(js_display)\n                .unwrap_or_else(|| \"undefined\".to_string());\n            io.err(&format!(\n                \"Live server already running on port {} (pid {}).\\n\",\n                port, pid\n            ));\n            let self_cmd = impeccable_context::provider::detect(&env, &cwd).self_cmd;\n            io.err(&format!(\n                \"Stop it first with: {} live-server stop\\n\",\n                self_cmd\n            ));\n            return 1;\n        }\n        let _ = std::fs::remove_file(&path);\n    }\n\n    let token = random_uuid();\n    let store = create_live_session_store(&cwd, &env, None);\n    let (log_tx, log_rx) = channel::<(bool, String)>();\n    let debug_events = env\n        .get(\"IMPECCABLE_LIVE_DEBUG_EVENTS\")","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/live/src/live_server.rs#L119-L155","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["If the existing server is valid, use it instead of starting a new one.","Stop the existing server first with `<self_cmd> live-server stop` (printed alongside this error), then start again.","If the pid in the message is dead, delete the stale server info file manually and re-run the start command."],"exampleFix":"// before\n$ ./scripts/impeccable live\nLive server already running on port 8400 (pid 4242).\n// after\n$ <self_cmd> live-server stop\n$ ./scripts/impeccable live","handlingStrategy":"fallback","validationCode":"// shell: reuse the running server instead of starting a duplicate\nif [ -f .impeccable/live-server.json ] && kill -0 \"$(jq -r .pid .impeccable/live-server.json)\" 2>/dev/null; then\n  echo 'server already running; reusing it'\nelse\n  ./scripts/impeccable live\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check whether the recorded pid is alive before calling start; reuse a healthy server.","Make start scripts idempotent: stop-then-start or check-then-start.","Clean up sessions on shutdown so stale info files don't linger."],"tags":["live-server","process-lifecycle","port-conflict"],"backgroundTag":"address-already-in-use","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}