{"record":{"id":"68f99e9e862c1815","repo":"zed-industries/zed","slug":"prompt-inputs-missing-run-context-retrieval-first-68f99e","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/repair.rs","lineNumber":294,"sourceCode":"/// - Turn 3 (User): Repair critique and instructions\n/// - Turn 4 (Assistant): Improved prediction (the response we parse)\npub async fn run_repair(\n    example: &mut Example,\n    args: &RepairArgs,\n    example_progress: &ExampleProgress,\n) -> Result<()> {\n    if has_successful_repair(example) {\n        return Ok(());\n    }\n\n    if !needs_repair(example, args.confidence_threshold) {\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    if example.predictions.is_empty() {\n        anyhow::bail!(\"no predictions available (run predict first)\");\n    }\n\n    let teacher_prompt = example\n        .prompt\n        .as_ref()\n        .context(\"prompt missing (run format_prompt first)\")?;\n\n    let teacher_response = &example.predictions[0].actual_output;\n    if teacher_response.is_empty() {\n        anyhow::bail!(\"teacher response is empty (run predict first)\");\n    }\n\n    let step_progress = example_progress.start(Step::Repair);\n","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/repair.rs#L276-L312","documentation":"Bailed by the repair step when the example has no `prompt_inputs`, which are produced by the context-retrieval step. Repair builds a teacher-correction prompt from the retrieved context, so it refuses to run on examples that skipped context retrieval. This is the same ordering guard as in the QA step, enforced before any model call.","triggerScenarios":"Invoking `ep repair` on examples where `prompt_inputs` is null: context retrieval never ran, failed, or the output file predates that stage of the pipeline.","commonSituations":"Resuming a batch from a partial run; reordering pipeline subcommands in a driver script; upstream retrieval failures silently skipped.","solutions":["Run context retrieval for the examples before the repair step","Verify `prompt_inputs` is populated in the intermediate JSONL","Fix any context-retrieval failure first, since repair cannot proceed without it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if example.prompt_inputs.is_none() {\n    // run the context-retrieval step before repair\n    anyhow::bail!(\"cannot run repair: run context retrieval first\");\n}","typeGuard":null,"tryCatchPattern":"Catch per example, log the example id with the message, and continue the batch so only unprepared examples fail.","preventionTips":["Check prompt_inputs presence before invoking repair on each example","Keep stage outputs in one append-only file so ordering is implicit","Smoke-test the full pipeline on a few examples before a large batch"],"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"}