zed-industries/zed · error

prompt_inputs missing (run context retrieval first)

Error message

prompt_inputs missing (run context retrieval first)

What it means

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.

Source

Thrown at crates/edit_prediction_cli/src/qa.rs:180

pub async fn run_qa(
    example: &mut Example,
    args: &QaArgs,
    example_progress: &ExampleProgress,
) -> Result<()> {
    if example
        .qa
        .first()
        .and_then(|q| q.as_ref())
        .and_then(|q| q.confidence)
        .is_some()
    {
        return Ok(());
    }

    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)");
    }

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

    let model = model_for_backend(args.backend);
    let prompt = build_prompt(example).context("Failed to build QA prompt")?;

    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. Run the context-retrieval step for the same input file before running QA again
  2. Inspect the example JSONL and confirm `prompt_inputs` is populated after retrieval
  3. If context retrieval itself errors, fix that first — its error message names the real cause
Defensive patterns

Strategy: validation

Validate before calling

if example.prompt_inputs.is_none() {
    // run the context-retrieval step for this example before QA
    anyhow::bail!("cannot run QA: run context retrieval first");
}

Try / catch

Treat this bail as per-example unrecoverable: report the example id, continue the batch, and re-queue the example for a context-retrieval pass.

Prevention

When it happens

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

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

Related errors


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