zed-industries/zed · error
repo path from status entry component
Error message
repo path from status entry component
What it means
A component-conversion guard when building the git panel tree in from_settings: each status entry's repo_path is decomposed into Path components that the code downcasts/expects to be plain str components. The expect fires if a path component is not representable as UTF-8 str (possible on Windows with non-Unicode names, or exotic byte sequences on Unix), meaning the file path from git status cannot be mapped into the panel's String-keyed tree nodes.
Source
Thrown at crates/git_ui/src/git_panel.rs:826
fn covers(&self, depth: usize) -> bool {
self.covering_depth
.is_some_and(|covering_depth| depth > covering_depth)
}
}
enum GitPanelViewMode {
Flat,
Tree(TreeViewState),
}
impl GitPanelViewMode {
fn from_settings(cx: &App) -> Self {
if GitPanelSettings::get_global(cx).tree_view {
GitPanelViewMode::Tree(TreeViewState::default())
} else {
GitPanelViewMode::Flat
}
}
fn tree_state(&self) -> Option<&TreeViewState> {
match self {
GitPanelViewMode::Tree(state) => Some(state),
GitPanelViewMode::Flat => None,
}
}
fn tree_state_mut(&mut self) -> Option<&mut TreeViewState> {
match self {
GitPanelViewMode::Tree(state) => Some(state),
GitPanelViewMode::Flat => None,
}
}
}
#[derive(Default)]
struct TreeViewState {View on GitHub (pinned to 5a9b9558db)
Solutions
- Use to_string_lossy (or filter with to_str()) when converting components so non-UTF-8 paths degrade instead of panicking
- Keep tree keys as PathBuf/OsString rather than String to make non-UTF-8 paths representable
- Skip entries whose repo_path cannot be converted and log them, leaving the rest of the panel functional
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/git_ui/src/git_panel.rs:827 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20).
Data as JSON: /api/errors/1a2e2ea21cba282a.
Report an issue: GitHub.