sxyazi/yazi · warning
Tab with id not found
Error message
Tab with id {id} not found What it means
Ctx::new() builds the actor context for an incoming action. If the action payload carries a `tab` field, that id is looked up in the manager's tab list; when no tab with that id exists, this anyhow! error aborts action handling. It protects against executing actions against a stale or nonexistent tab.
Solutions
- Refresh or re-read the target tab id immediately before dispatching the action instead of caching it.
- Omit the `tab` field to let Ctx::new fall back to the current cursor tab.
- Check the id against mgr.tabs before sending the action and skip if absent.
Example fix
// before
rx.send(Action::new("tab_switch", tab_id))?
// after
if core.mgr.tabs.idx(tab_id).is_some() {
rx.send(Action::new("tab_switch", tab_id))?;
} Defensive patterns
Strategy: validation
Validate before calling
// Rust plugin/action dispatch site
if let Ok(id) = action.get::<Id>("tab") {
if core.mgr.tabs.idx(id).is_none() {
return; // skip stale tab
}
} Try / catch
match Ctx::new(&action, core, term) {
Ok(ctx) => { /* handle */ }
Err(e) if e.to_string().contains("not found") => { /* tab vanished; ignore or refresh */ }
Err(e) => return Err(e),
} Prevention
- Never cache tab ids across dispatches; resolve from current state.
- Omit the `tab` field when the current tab is acceptable.
- Re-check tab existence after any tab-close event before firing queued actions.
When it happens
Trigger: Calling an actor action with `tab` set to an id that is not currently in core.mgr.tabs — e.g. an id that was closed just before dispatch, a hardcoded id in a keymap/plugin, or an id from a stale event.
Common situations: Plugins or keymaps that capture a Tab id and fire an action after the tab was closed; IPC/remote commands referencing a tab from another session; race between tab close and pending action dispatch.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
AI-assisted analysis of sxyazi/yazi@a541adde4e (2026-09-02).
Data as JSON: /api/errors/9ee5bc740a6933be.
Report an issue: GitHub.
Appendix: source
Thrown at yazi-actor/src/context.rs:32
source: Source,
#[cfg(debug_assertions)]
pub backtrace: Vec<&'static str>,
}
impl Deref for Ctx<'_> {
type Target = Core;
fn deref(&self) -> &Self::Target { self.core }
}
impl DerefMut for Ctx<'_> {
fn deref_mut(&mut self) -> &mut Self::Target { self.core }
}
impl<'a> Ctx<'a> {
pub fn new(action: &Action, core: &'a mut Core, term: &'a mut Option<Raterm>) -> Result<Self> {
let tab = if let Ok(id) = action.get::<Id>("tab") {
core.mgr.tabs.idx(id).ok_or_else(|| anyhow!("Tab with id {id} not found"))?
} else {
core.mgr.tabs.cursor
};
Ok(Self {
core,
term,
tab,
level: 0,
source: action.source,
#[cfg(debug_assertions)]
backtrace: vec![],
})
}
pub(crate) fn with<F, T>(&mut self, tab: usize, f: F) -> T
where
F: FnOnce(&mut Self) -> T,View on GitHub (pinned to a541adde4e)