{"record":{"id":"50f897c1bded6a67","repo":"zed-industries/zed","slug":"failed-to-read-from-stdin","errorCode":null,"errorMessage":"Failed to read from stdin","messagePattern":"Failed to read from stdin","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_cli/src/example.rs","lineNumber":224,"sourceCode":"\nimpl RepoName<'_> {\n    pub fn worktree_path(&self) -> PathBuf {\n        WORKTREES_DIR\n            .join(self.owner.as_ref())\n            .join(self.name.as_ref())\n    }\n}\n\npub fn read_example_files(inputs: &[PathBuf]) -> Vec<Example> {\n    let mut examples = Vec::new();\n\n    for path in inputs {\n        let is_stdin = path.as_path() == Path::new(\"-\");\n        let content = if is_stdin {\n            let mut buffer = String::new();\n            std::io::stdin()\n                .read_to_string(&mut buffer)\n                .expect(\"Failed to read from stdin\");\n            buffer\n        } else {\n            std::fs::read_to_string(path)\n                .unwrap_or_else(|_| panic!(\"Failed to read path: {path:?}\"))\n        };\n        let filename = path.file_stem().unwrap().to_string_lossy().to_string();\n        let ext = if !is_stdin {\n            path.extension()\n                .map(|ext| ext.to_string_lossy().to_string())\n                .unwrap_or_else(|| panic!(\"{} should have an extension\", path.display()))\n        } else {\n            \"jsonl\".to_string()\n        };\n\n        match ext.as_ref() {\n            \"json\" => {\n                let mut example =\n                    serde_json::from_str::<Example>(&content).unwrap_or_else(|error| {","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/example.rs#L206-L242","documentation":"Panics in the edit prediction CLI's read_example_files when reading examples from stdin (`-` input path) fails — stdin was closed or is not readable text. This is a developer CLI tooling path, not user-facing.","triggerScenarios":"Thrown at crates/edit_prediction_cli/src/example.rs:224 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pipe valid UTF-8 data into the command instead of running it without stdin","Check that the upstream producer didn't close the pipe early","Pass file paths instead of `-` if stdin is unavailable"],"exampleFix":null,"handlingStrategy":"validation","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"}