zed-industries/zed · error
Edited sub-entry should be an ancestor of selected leaf entr
Error message
Edited sub-entry should be an ancestor of selected leaf entry
What it means
An assertion in project panel editing: the entry being edited (new or renamed) must be the selected leaf entry or one of its ancestors; a mismatch means the edit state and the tree selection diverged, usually a state-sync bug after folding or ancestor-tracking changes.
Source
Thrown at crates/project_panel/src/project_panel.rs:5253
continue;
}
let end_ix = range.end.min(ix + visible.entries.len());
let entry_range = range.start.saturating_sub(ix)..end_ix - ix;
let entries = visible
.index
.get_or_init(|| visible.entries.iter().map(|e| e.path.clone()).collect());
let base_index = ix + entry_range.start;
for (i, entry) in visible.entries[entry_range].iter().enumerate() {
let global_index = base_index + i;
callback(entry, global_index, entries, window, cx);
}
ix = end_ix;
}
}
fn for_each_visible_entry(
&self,
range: Range<usize>,
window: &mut Window,
cx: &mut Context<ProjectPanel>,
callback: &mut dyn FnMut(
ProjectEntryId,
EntryDetails,
&mut Window,
&mut Context<ProjectPanel>,
),
) {
let mut ix = 0;
for visible in &self.state.visible_entries {
if ix >= range.end {
return;
}
if ix + visible.entries.len() <= range.start {
ix += visible.entries.len();View on GitHub (pinned to 9d272b0363)
Solutions
- Recompute edit_state from the current selection when the tree changes
- Ensure ancestors map is updated whenever entries are folded/unfolded
- Cancel any active edit when selection changes to an unrelated entry
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/project_panel/src/project_panel.rs:5248 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20).
Data as JSON: /api/errors/df98fdb5622030a8.
Report an issue: GitHub.