zed-industries/zed · error

teacher response is empty (run predict first)

Error message

teacher response is empty (run predict first)

What it means

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.

Source

Thrown at crates/edit_prediction_cli/src/repair.rs:308

    run_parse_output(example).context("Failed to execute run_parse_output")?;

    if example.prompt_inputs.is_none() {
        anyhow::bail!("prompt_inputs missing (run context retrieval first)");
    }

    if example.predictions.is_empty() {
        anyhow::bail!("no predictions available (run predict first)");
    }

    let teacher_prompt = example
        .prompt
        .as_ref()
        .context("prompt missing (run format_prompt first)")?;

    let teacher_response = &example.predictions[0].actual_output;
    if teacher_response.is_empty() {
        anyhow::bail!("teacher response is empty (run predict first)");
    }

    let step_progress = example_progress.start(Step::Repair);

    let model = model_for_backend(args.backend);
    let repair_message = build_repair_message(example).context("Failed to build repair message")?;

    step_progress.set_substatus("generating");

    let response = match args.backend {
        BatchProvider::Anthropic => {
            let client = if args.no_batch {
                ANTHROPIC_CLIENT_PLAIN.get_or_init(|| {
                    AnthropicClient::plain().expect("Failed to create Anthropic client")
                })
            } else {
                ANTHROPIC_CLIENT_BATCH.get_or_init(|| {
                    AnthropicClient::batch(&LLM_CACHE_DB)

View on GitHub (pinned to f4178619ac)

Solutions

  1. Re-run predict for the affected examples so a non-empty teacher response is stored
  2. Inspect the stored prediction record for an accompanying provider error or unusual finish reason
  3. Add a predict-side check that rejects or retries empty completions instead of persisting them

Example fix

// before
let actual_output = response.text; // may be empty and still gets stored

// after
if response.text.is_empty() {
    anyhow::bail!("provider returned an empty completion, not storing prediction");
}
let actual_output = response.text;
Defensive patterns

Strategy: validation

Validate before calling

if let Some(first) = example.predictions.first() {
    if first.actual_output.is_empty() {
        // re-run predict for this example instead of repairing
    }
}

Try / catch

On this bail, re-queue the example through predict (optionally with a retry) rather than repairing — repair cannot proceed without teacher content.

Prevention

When it happens

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

Common situations: Rate-limited or flaky provider runs storing empty outputs; models refusing and returning empty content; max-token truncation producing empty text.

Related errors


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/09e7b6f853538683. Report an issue: GitHub.