zed-industries/zed · error

Failed to write to output file

Error message

Failed to write to output file

What it means

A panic in the edit-prediction CLI resume path: while rewriting the output file with only the kept (not-yet-processed) lines, a writeln! to the BufWriter failed — typically disk full or the file removed. The CLI has no recovery strategy here and aborts.

Source

Thrown at crates/edit_prediction_cli/src/main.rs:1070

        }
    }

    let total = examples.len();
    let already_processed = kept_hashes.len();

    eprintln!(
        "Resuming: {}/{} examples already processed",
        already_processed, total
    );

    let file = OpenOptions::new()
        .write(true)
        .truncate(true)
        .open(path)
        .expect("Failed to open output file for rewriting");
    let mut writer = BufWriter::new(file);
    for line in &kept_lines {
        writeln!(writer, "{}", line).expect("Failed to write to output file");
    }
    writer.flush().expect("Failed to flush output file");

    examples.retain(|e| !kept_hashes.contains(&spec_hash(&e.spec)));
}

fn main() {
    let args = EpArgs::parse();

    if args.printenv {
        ::util::shell_env::print_env();
        return;
    }

    let output = args.output_path();

    if args.markdown && output.is_none() {
        eprintln!("--markdown requires -o to specify the output directory");

View on GitHub (pinned to f4178619ac)

Solutions

  1. Check free disk space and file permissions
  2. Retry the run; kept_lines are held in memory so nothing is lost until this point
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/edit_prediction_cli/src/main.rs:1070 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/4a62f32444c0bbcc. Report an issue: GitHub.