{"record":{"id":"1652aca4aea92165","repo":"zed-industries/zed","slug":"failed-to-rename-temp-file-to-final-output","errorCode":null,"errorMessage":"Failed to rename temp file to final output","messagePattern":"Failed to rename temp file to final output","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_cli/src/main.rs","lineNumber":1575,"sourceCode":"                                &examples,\n                                summary_path,\n                                Some(args.related_context_limit * 3),\n                                context_source_filter.as_deref(),\n                            )?;\n                        }\n                    }\n                    Command::Repair(args) => {\n                        let examples = finished_examples.lock().unwrap();\n                        repair::print_report(&examples, args.confidence_threshold);\n                    }\n                    _ => (),\n                };\n\n                // For --in-place, atomically rename temp file to original\n                if let Some(temp_path) = &in_place_temp_path {\n                    let final_path = output.as_ref().expect(\"in_place_temp_path requires output\");\n                    std::fs::rename(temp_path, final_path)\n                        .expect(\"Failed to rename temp file to final output\");\n                }\n\n                anyhow::Ok(())\n            }\n            .await;\n\n            if let Err(e) = result {\n                panic!(\"Fatal error: {:?}\", e);\n            }\n\n            let _ = cx.update(|cx| cx.quit());\n        })\n        .detach();\n    });\n}\n\nfn rewrite_output(\n    examples: &[Example],","sourceCodeStart":1557,"sourceCodeEnd":1593,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/main.rs#L1557-L1593","documentation":"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.","triggerScenarios":"Thrown at crates/edit_prediction_cli/src/main.rs:1575 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the temp `.jsonl.tmp` still exists and manually rename it over the output","Ensure temp and output are on the same filesystem","Close processes holding the output file open"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}