{"record":{"id":"6d63b10e58dfe809","repo":"pbakaus/impeccable","slug":"serve-question-no-live-question-server-for-that-k","errorCode":null,"errorMessage":"serve-question: no live question server for that key; the page it served is gone too. Re-present the round with --start and a fresh key, or fall back to the structured question tool.\n","messagePattern":"serve-question: no live question server for that key; the page it served is gone too\\. Re-present the round with --start and a fresh key, or fall back to the structured question tool\\.\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/context/src/serve_question.rs","lineNumber":307,"sourceCode":"        let key = a.arg(\"key\");\n        let (Some(key), Some(pp)) = (key, payload_path.clone()) else {\n            io.err(\"serve-question: --update needs --key and --payload\\n\");\n            return 1;\n        };\n        let next_round = match read_json_file(&jsp::resolve(&cwd, &[&pp])) {\n            Ok(v) => v,\n            Err(msg) => {\n                io.err(&format!(\"{}\\n\", msg));\n                return 1;\n            }\n        };\n        let ok = next_round.get(\"options\").and_then(|o| o.as_array()).map(|o| !o.is_empty()).unwrap_or(false);\n        if !ok {\n            io.err(\"serve-question: --update payload needs an options array; nothing was delivered. Fix the payload and rerun --update on the same key.\\n\");\n            return 1;\n        }\n        if !is_alive(&qdir, &key) {\n            io.err(\"serve-question: no live question server for that key; the page it served is gone too. Re-present the round with --start and a fresh key, or fall back to the structured question tool.\\n\");\n            return 2;\n        }\n        let delivered = next_file(&qdir, &key);\n        let _ = std::fs::copy(jsp::resolve(&cwd, &[&pp]), &delivered);\n        touch_now(&delivered);\n        io.out(\"next round delivered; the page reloads itself\\n\");\n        return 0;\n    }\n\n    if a.has(\"start\") {\n        let Some(pp) = payload_path.clone() else {\n            io.err(\"serve-question: --start needs --payload <file>\\n\");\n            return 1;\n        };\n        if let Err(msg) = read_json_file(&jsp::resolve(&cwd, &[&pp])) {\n            io.err(&format!(\"{}\\n\", msg));\n            return 1;\n        }","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/context/src/serve_question.rs#L289-L325","documentation":"--update refuses to deliver a round when no live question server exists for the given key (is_alive check fails): the page the server was serving is gone. It prints remediation advice, exits with code 2, and suggests re-presenting via --start with a fresh key or falling back to the structured question tool.","triggerScenarios":"Calling --update with a key whose server process has exited, was killed (--stop), crashed, or never existed under that key.","commonSituations":"Long delays between rounds while the server timed out; the user closed the served page/session; machine restart killed the server; using a key from a previous session.","solutions":["Re-present the question with --start and a fresh key, then chain subsequent rounds to the new key.","If interactive delivery is not required, fall back to the structured question tool.","Check the qdir log/state files to confirm when the server died if diagnosing is important."],"exampleFix":"// before\nserve-question --update --key q-old --payload round2.json   # exit 2, server gone\n// after\nserve-question --start --key q-new --payload round1.json\nserve-question --update --key q-new --payload round2.json","handlingStrategy":"fallback","validationCode":"// best-effort precheck: state file mtime recency suggests the server may still be alive\nconst statePath = `${qdir}/${key}.state`;\nconst stale = !fs.existsSync(statePath) || Date.now() - fs.statSync(statePath).mtimeMs > 5 * 60_000;","typeGuard":"null","tryCatchPattern":"const res = spawnSync('serve-question', args);\nif (res.status === 2 && res.stderr.includes('no live question server')) {\n  // fallback: re-present with --start and a fresh key, or use the structured question tool\n}","preventionTips":["Treat keys as session-scoped: never reuse keys across sessions or restarts","Deliver follow-up rounds promptly before the server times out","Implement the structured-question-tool fallback for long-running flows"],"tags":["cli","process-lifecycle","stale-state"],"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"}