{"record":{"id":"b770d5b3b7ba672a","repo":"zed-industries/zed","slug":"failed-to-open-output-file","errorCode":null,"errorMessage":"Failed to open output file","messagePattern":"Failed to open output file","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_cli/src/main.rs","lineNumber":1276,"sourceCode":"                let mut in_place_temp_path: Option<PathBuf> = None;\n                if !args.markdown\n                    && let Some(output_path) = output.as_ref()\n                {\n                    let write_path = if args.in_place {\n                        let temp = output_path.with_extension(\"jsonl.tmp\");\n                        in_place_temp_path = Some(temp.clone());\n                        temp\n                    } else {\n                        output_path.clone()\n                    };\n\n                    let file = OpenOptions::new()\n                        .create(true)\n                        .write(true)\n                        .truncate(args.in_place)\n                        .append(!args.in_place)\n                        .open(&write_path)\n                        .expect(\"Failed to open output file\");\n\n                    let mut writer = BufWriter::new(file);\n                    let (sender, mut receiver) = mpsc::unbounded::<String>();\n                    cx.background_spawn(async move {\n                        while let Some(line) = receiver.next().await {\n                            writeln!(writer, \"{}\", line).expect(\"Failed to write example\");\n                            writer.flush().expect(\"Failed to flush output\");\n                        }\n                    })\n                    .detach();\n                    output_sender = Some(sender);\n                }\n\n                let example_batches = if args.group_by_repo {\n                    group_examples_by_repo(examples)\n                } else {\n                    chunk_examples(examples, args.max_parallelism)\n                };","sourceCodeStart":1258,"sourceCodeEnd":1294,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/main.rs#L1258-L1294","documentation":"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.","triggerScenarios":"Thrown at crates/edit_prediction_cli/src/main.rs:1276 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the output path is writable and its directory exists","Ensure no other process locks the output file","For in-place runs, verify the temp `.jsonl.tmp` file can be created"],"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"}