zed-industries/zed · error

Failed to rename temp file to final output

Error message

Failed to rename temp file to final output

What it means

A panic in the edit-prediction CLI when, after writing results to the in-place temp file (.jsonl.tmp), renaming it over the final output path fails (e.g. cross-device or permission error). The rewrite-in-place workflow cannot complete, so the CLI aborts.

Source

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

                                &examples,
                                summary_path,
                                Some(args.related_context_limit * 3),
                                context_source_filter.as_deref(),
                            )?;
                        }
                    }
                    Command::Repair(args) => {
                        let examples = finished_examples.lock().unwrap();
                        repair::print_report(&examples, args.confidence_threshold);
                    }
                    _ => (),
                };

                // For --in-place, atomically rename temp file to original
                if let Some(temp_path) = &in_place_temp_path {
                    let final_path = output.as_ref().expect("in_place_temp_path requires output");
                    std::fs::rename(temp_path, final_path)
                        .expect("Failed to rename temp file to final output");
                }

                anyhow::Ok(())
            }
            .await;

            if let Err(e) = result {
                panic!("Fatal error: {:?}", e);
            }

            let _ = cx.update(|cx| cx.quit());
        })
        .detach();
    });
}

fn rewrite_output(
    examples: &[Example],

View on GitHub (pinned to f4178619ac)

Solutions

  1. Check the temp `.jsonl.tmp` still exists and manually rename it over the output
  2. Ensure temp and output are on the same filesystem
  3. Close processes holding the output file open
Defensive patterns

Strategy: retry

When it happens

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