zed-industries/zed · error

Failed to open output file

Error message

Failed to open output file

What it means

A panic in the edit-prediction CLI when opening the output file (or the in-place .jsonl.tmp temp file) with the configured create/write/truncate/append flags fails — e.g. permission denied or a bad path. The results writer cannot be set up, so the run aborts.

Solutions

  1. Check the output path is writable and its directory exists
  2. Ensure no other process locks the output file
  3. For in-place runs, verify the temp `.jsonl.tmp` file can be created
Defensive patterns

Strategy: retry

When it happens

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

Appendix: source

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

                let mut in_place_temp_path: Option<PathBuf> = None;
                if !args.markdown
                    && let Some(output_path) = output.as_ref()
                {
                    let write_path = if args.in_place {
                        let temp = output_path.with_extension("jsonl.tmp");
                        in_place_temp_path = Some(temp.clone());
                        temp
                    } else {
                        output_path.clone()
                    };

                    let file = OpenOptions::new()
                        .create(true)
                        .write(true)
                        .truncate(args.in_place)
                        .append(!args.in_place)
                        .open(&write_path)
                        .expect("Failed to open output file");

                    let mut writer = BufWriter::new(file);
                    let (sender, mut receiver) = mpsc::unbounded::<String>();
                    cx.background_spawn(async move {
                        while let Some(line) = receiver.next().await {
                            writeln!(writer, "{}", line).expect("Failed to write example");
                            writer.flush().expect("Failed to flush output");
                        }
                    })
                    .detach();
                    output_sender = Some(sender);
                }

                let example_batches = if args.group_by_repo {
                    group_examples_by_repo(examples)
                } else {
                    chunk_examples(examples, args.max_parallelism)
                };

View on GitHub (pinned to f4178619ac)