{"record":{"id":"e6e5a42cc1cdaab3","repo":"zed-industries/zed","slug":"failed-to-flush-output-file","errorCode":null,"errorMessage":"Failed to flush output file","messagePattern":"Failed to flush output file","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_cli/src/main.rs","lineNumber":1072,"sourceCode":"\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\");\n        std::process::exit(1);\n    }","sourceCodeStart":1054,"sourceCodeEnd":1090,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/main.rs#L1054-L1090","documentation":"Panics when the final flush of the buffered output writer fails at the end of the CLI's resume rewrite — buffered data could not be committed to disk (disk full or I/O error), risking loss of the rewritten examples file.","triggerScenarios":"Thrown at crates/edit_prediction_cli/src/main.rs:1072 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Free disk space and re-run the command","Check the output filesystem for errors (dmesg, fsck)"],"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"}