{"record":{"id":"09e7b6f853538683","repo":"zed-industries/zed","slug":"teacher-response-is-empty-run-predict-first","errorCode":null,"errorMessage":"teacher response is empty (run predict first)","messagePattern":"teacher response is empty \\(run predict first\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_cli/src/repair.rs","lineNumber":308,"sourceCode":"\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\n    let model = model_for_backend(args.backend);\n    let repair_message = build_repair_message(example).context(\"Failed to build repair message\")?;\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":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/repair.rs#L290-L326","documentation":"Bailed by the repair step when predictions exist but `predictions[0].actual_output` is an empty string. The teacher response is the model completion the repair prompt is built from; empty means the prediction call finished without content — an empty completion was stored, a provider error was swallowed into an empty record, or output parsing stripped everything.","triggerScenarios":"Running repair on examples where predict recorded a prediction entry with empty `actual_output`: provider returned an empty completion, the request failed but an empty record was persisted, or content filtering removed the output.","commonSituations":"Rate-limited or flaky provider runs storing empty outputs; models refusing and returning empty content; max-token truncation producing empty text.","solutions":["Re-run predict for the affected examples so a non-empty teacher response is stored","Inspect the stored prediction record for an accompanying provider error or unusual finish reason","Add a predict-side check that rejects or retries empty completions instead of persisting them"],"exampleFix":"// before\nlet actual_output = response.text; // may be empty and still gets stored\n\n// after\nif response.text.is_empty() {\n    anyhow::bail!(\"provider returned an empty completion, not storing prediction\");\n}\nlet actual_output = response.text;","handlingStrategy":"validation","validationCode":"if let Some(first) = example.predictions.first() {\n    if first.actual_output.is_empty() {\n        // re-run predict for this example instead of repairing\n    }\n}","typeGuard":null,"tryCatchPattern":"On this bail, re-queue the example through predict (optionally with a retry) rather than repairing — repair cannot proceed without teacher content.","preventionTips":["Reject or retry empty completions in the predict stage before persisting","Log provider finish reasons next to outputs to spot empty-content cases","Add a batch-level check that flags examples with empty actual_output before repair runs"],"tags":["llm-output","pipeline-ordering","edit-prediction","rust"],"backgroundTag":"llm-empty-response","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"}