{"record":{"id":"4a62f32444c0bbcc","repo":"zed-industries/zed","slug":"failed-to-write-to-output-file","errorCode":null,"errorMessage":"Failed to write to output file","messagePattern":"Failed to write to output file","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_cli/src/main.rs","lineNumber":1070,"sourceCode":"        }\n    }\n\n    let total = examples.len();\n    let already_processed = kept_hashes.len();\n\n    eprintln!(\n        \"Resuming: {}/{} examples already processed\",\n        already_processed, total\n    );\n\n    let file = OpenOptions::new()\n        .write(true)\n        .truncate(true)\n        .open(path)\n        .expect(\"Failed to open output file for rewriting\");\n    let mut writer = BufWriter::new(file);\n    for line in &kept_lines {\n        writeln!(writer, \"{}\", line).expect(\"Failed to write to output file\");\n    }\n    writer.flush().expect(\"Failed to flush output file\");\n\n    examples.retain(|e| !kept_hashes.contains(&spec_hash(&e.spec)));\n}\n\nfn main() {\n    let args = EpArgs::parse();\n\n    if args.printenv {\n        ::util::shell_env::print_env();\n        return;\n    }\n\n    let output = args.output_path();\n\n    if args.markdown && output.is_none() {\n        eprintln!(\"--markdown requires -o to specify the output directory\");","sourceCodeStart":1052,"sourceCodeEnd":1088,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/main.rs#L1052-L1088","documentation":"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.","triggerScenarios":"Thrown at crates/edit_prediction_cli/src/main.rs:1070 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check free disk space and file permissions","Retry the run; kept_lines are held in memory so nothing is lost until this point"],"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-14T00:17:10.932Z"}