{"record":{"id":"3f7110226fa6b0b7","repo":"pbakaus/impeccable","slug":"stop-it-first-with-self-cmd-live-server-stop","errorCode":null,"errorMessage":"Stop it first with: {self_cmd} live-server stop\n","messagePattern":"Stop it first with: (.+?) live-server stop\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/live/src/live_server.rs","lineNumber":142,"sourceCode":"            .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\")\n        .map(|v| matches!(v.to_ascii_lowercase().as_str(), \"1\" | \"true\" | \"yes\"))\n        .unwrap_or(false);\n    let detect_script = load_detect_script(&env, &cwd);\n    let shared: Shared = Arc::new_cyclic(|weak| {\n        Mutex::new(ServerState {","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/live/src/live_server.rs#L124-L160","documentation":"This is the companion remediation line printed immediately after the 'Live server already running' message. It tells the user the exact command (`<self_cmd> live-server stop`, where self_cmd is the detected provider/CLI name) to stop the running server before starting a new one. It appears whenever a duplicate live-server start is attempted.","triggerScenarios":"Same as error 146: a `live` start attempt while an existing session info file with port/pid exists; this line is the second stderr line emitted before returning exit code 1.","commonSituations":"Scripts that blindly call `live` on every run without checking for an existing session; CI jobs reusing a workspace with a live server still registered.","solutions":["Run the printed stop command (`<self_cmd> live-server stop`) before starting a new live server.","Make start logic stop-then-start or check-then-start when a session already exists.","Remove the stale info file if the recorded pid is no longer alive."],"exampleFix":"// before\n$ ./scripts/impeccable live\nStop it first with: impeccable live-server stop\n// after\n$ impeccable live-server stop\n$ ./scripts/impeccable live","handlingStrategy":"fallback","validationCode":"// run the printed remediation automatically when a duplicate start is detected\npid=$(jq -r .pid .impeccable/live-server.json 2>/dev/null)\nif [ -n \"$pid\" ] && kill -0 \"$pid\" 2>/dev/null; then <self_cmd> live-server stop; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat `live-server stop` as the required transition step before every fresh start in scripts.","Log session lifecycle (start/stop) so duplicate starts are visible.","In CI, always stop the server in a teardown step, even on failure."],"tags":["live-server","process-lifecycle"],"backgroundTag":"invalid-state-transition","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}