zed-industries/zed · error
Failed to read from stdin
Error message
Failed to read from stdin
What it means
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.
Source
Thrown at crates/edit_prediction_cli/src/example.rs:224
impl RepoName<'_> {
pub fn worktree_path(&self) -> PathBuf {
WORKTREES_DIR
.join(self.owner.as_ref())
.join(self.name.as_ref())
}
}
pub fn read_example_files(inputs: &[PathBuf]) -> Vec<Example> {
let mut examples = Vec::new();
for path in inputs {
let is_stdin = path.as_path() == Path::new("-");
let content = if is_stdin {
let mut buffer = String::new();
std::io::stdin()
.read_to_string(&mut buffer)
.expect("Failed to read from stdin");
buffer
} else {
std::fs::read_to_string(path)
.unwrap_or_else(|_| panic!("Failed to read path: {path:?}"))
};
let filename = path.file_stem().unwrap().to_string_lossy().to_string();
let ext = if !is_stdin {
path.extension()
.map(|ext| ext.to_string_lossy().to_string())
.unwrap_or_else(|| panic!("{} should have an extension", path.display()))
} else {
"jsonl".to_string()
};
match ext.as_ref() {
"json" => {
let mut example =
serde_json::from_str::<Example>(&content).unwrap_or_else(|error| {View on GitHub (pinned to f4178619ac)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/edit_prediction_cli/src/example.rs:224 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/50f897c1bded6a67.
Report an issue: GitHub.