pbakaus/impeccable · error

serve-question: no live question server for that key; the pa

Error message

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.

What it means

--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.

Source

Thrown at crates/context/src/serve_question.rs:307

        let key = a.arg("key");
        let (Some(key), Some(pp)) = (key, payload_path.clone()) else {
            io.err("serve-question: --update needs --key and --payload\n");
            return 1;
        };
        let next_round = match read_json_file(&jsp::resolve(&cwd, &[&pp])) {
            Ok(v) => v,
            Err(msg) => {
                io.err(&format!("{}\n", msg));
                return 1;
            }
        };
        let ok = next_round.get("options").and_then(|o| o.as_array()).map(|o| !o.is_empty()).unwrap_or(false);
        if !ok {
            io.err("serve-question: --update payload needs an options array; nothing was delivered. Fix the payload and rerun --update on the same key.\n");
            return 1;
        }
        if !is_alive(&qdir, &key) {
            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");
            return 2;
        }
        let delivered = next_file(&qdir, &key);
        let _ = std::fs::copy(jsp::resolve(&cwd, &[&pp]), &delivered);
        touch_now(&delivered);
        io.out("next round delivered; the page reloads itself\n");
        return 0;
    }

    if a.has("start") {
        let Some(pp) = payload_path.clone() else {
            io.err("serve-question: --start needs --payload <file>\n");
            return 1;
        };
        if let Err(msg) = read_json_file(&jsp::resolve(&cwd, &[&pp])) {
            io.err(&format!("{}\n", msg));
            return 1;
        }

View on GitHub (pinned to 2bc2879276)

Solutions

  1. Re-present the question with --start and a fresh key, then chain subsequent rounds to the new key.
  2. If interactive delivery is not required, fall back to the structured question tool.
  3. Check the qdir log/state files to confirm when the server died if diagnosing is important.

Example fix

// before
serve-question --update --key q-old --payload round2.json   # exit 2, server gone
// after
serve-question --start --key q-new --payload round1.json
serve-question --update --key q-new --payload round2.json
Defensive patterns

Strategy: fallback

Validate before calling

// best-effort precheck: state file mtime recency suggests the server may still be alive
const statePath = `${qdir}/${key}.state`;
const stale = !fs.existsSync(statePath) || Date.now() - fs.statSync(statePath).mtimeMs > 5 * 60_000;

Type guard

null

Try / catch

const res = spawnSync('serve-question', args);
if (res.status === 2 && res.stderr.includes('no live question server')) {
  // fallback: re-present with --start and a fresh key, or use the structured question tool
}

Prevention

When it happens

Trigger: Calling --update with a key whose server process has exited, was killed (--stop), crashed, or never existed under that key.

Common situations: 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.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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