zed-industries/zed · error

instruction is empty

Error message

instruction is empty

What it means

read_instruction found that the final instruction text — from --instruction or stdin — is empty or only whitespace. The ensure! guard rejects blank instructions because an agent run with no prompt is meaningless; this is a CLI usage error, not an I/O failure (stdin read already succeeded).

Source

Thrown at crates/eval_cli/src/main.rs:402

    SettingsStore::update_global(cx, |store, cx| {
        store.set_user_settings(&settings, cx).result()
    })
    .context("applying anthropic available_models settings")?;
    Ok(())
}

fn read_instruction(args: &Args) -> Result<String> {
    let mut text = if let Some(text) = &args.instruction {
        text.clone()
    } else {
        use std::io::Read;
        let mut buf = String::new();
        std::io::stdin()
            .read_to_string(&mut buf)
            .context("reading instruction from stdin")?;
        buf
    };
    anyhow::ensure!(!text.trim().is_empty(), "instruction is empty");

    if let Some(path) = &args.instruction_suffix_file {
        let suffix = read_instruction_suffix_file(path)?;
        text.push_str("\n\n");
        text.push_str(&suffix);
    }
    Ok(text)
}

fn read_instruction_suffix_file(path: &PathBuf) -> Result<String> {
    let suffix = std::fs::read_to_string(path)
        .with_context(|| format!("reading instruction suffix file {}", path.display()))?;
    let suffix = suffix.trim().to_string();
    anyhow::ensure!(!suffix.is_empty(), "instruction suffix file is empty");
    Ok(suffix)
}

async fn wait_for_model(selected: &SelectedModel, cx: &mut AsyncApp) -> Result<()> {

View on GitHub (pinned to f4178619ac)

Solutions

  1. Provide a non-empty --instruction argument or pipe actual prompt text into stdin
  2. Trim/check input before invoking eval_cli in scripts and fail early with a clearer message
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/eval_cli/src/main.rs:402 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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