{"record":{"id":"6f5713431e1628c5","repo":"zed-industries/zed","slug":"prompt-inputs-missing-run-context-retrieval-first","errorCode":null,"errorMessage":"prompt_inputs missing (run context retrieval first)","messagePattern":"prompt_inputs missing \\(run context retrieval first\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_cli/src/qa.rs","lineNumber":180,"sourceCode":"pub async fn run_qa(\n    example: &mut Example,\n    args: &QaArgs,\n    example_progress: &ExampleProgress,\n) -> Result<()> {\n    if example\n        .qa\n        .first()\n        .and_then(|q| q.as_ref())\n        .and_then(|q| q.confidence)\n        .is_some()\n    {\n        return Ok(());\n    }\n\n    run_parse_output(example).context(\"Failed to execute run_parse_output\")?;\n\n    if example.prompt_inputs.is_none() {\n        anyhow::bail!(\"prompt_inputs missing (run context retrieval first)\");\n    }\n\n    let step_progress = example_progress.start(Step::Qa);\n\n    let model = model_for_backend(args.backend);\n    let prompt = build_prompt(example).context(\"Failed to build QA prompt\")?;\n\n    step_progress.set_substatus(\"generating\");\n\n    let response = match args.backend {\n        BatchProvider::Anthropic => {\n            let client = if args.no_batch {\n                ANTHROPIC_CLIENT_PLAIN.get_or_init(|| {\n                    AnthropicClient::plain().expect(\"Failed to create Anthropic client\")\n                })\n            } else {\n                ANTHROPIC_CLIENT_BATCH.get_or_init(|| {\n                    AnthropicClient::batch(&LLM_CACHE_DB)","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/qa.rs#L162-L198","documentation":"Bailed by the QA step when the example has no `prompt_inputs`, the field populated by the context-retrieval step. It is a pipeline-ordering guard: QA builds its prompt from the retrieved context, so running QA on an example that never went through context retrieval (or whose retrieval failed) aborts with this message instead of sending a malformed prompt to the model.","triggerScenarios":"Invoking `ep qa` on examples whose `prompt_inputs` is null: the context-retrieval step was never run, ran with collectors that produced nothing, or the run was resumed from a stale/partial JSONL written before context retrieval completed.","commonSituations":"Re-running a later pipeline stage on old output files; scripts that reorder subcommands; an upstream context-retrieval failure that was skipped instead of fixed.","solutions":["Run the context-retrieval step for the same input file before running QA again","Inspect the example JSONL and confirm `prompt_inputs` is populated after retrieval","If context retrieval itself errors, fix that first — its error message names the real cause"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if example.prompt_inputs.is_none() {\n    // run the context-retrieval step for this example before QA\n    anyhow::bail!(\"cannot run QA: run context retrieval first\");\n}","typeGuard":null,"tryCatchPattern":"Treat this bail as per-example unrecoverable: report the example id, continue the batch, and re-queue the example for a context-retrieval pass.","preventionTips":["Run pipeline stages in the documented order (download → context retrieval → prompt → predict → qa/repair)","Persist per-stage state and assert required fields exist before each stage starts","Never resume a later stage from an intermediate file older than the stage it depends on"],"tags":["pipeline-ordering","edit-prediction","cli","rust"],"backgroundTag":"missing-prerequisite-state","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}