{"record":{"id":"9ee5bc740a6933be","repo":"sxyazi/yazi","slug":"tab-with-id-id-not-found","errorCode":null,"errorMessage":"Tab with id {id} not found","messagePattern":"Tab with id (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"yazi-actor/src/context.rs","lineNumber":32,"sourceCode":"\tsource:          Source,\n\t#[cfg(debug_assertions)]\n\tpub backtrace:   Vec<&'static str>,\n}\n\nimpl Deref for Ctx<'_> {\n\ttype Target = Core;\n\n\tfn deref(&self) -> &Self::Target { self.core }\n}\n\nimpl DerefMut for Ctx<'_> {\n\tfn deref_mut(&mut self) -> &mut Self::Target { self.core }\n}\n\nimpl<'a> Ctx<'a> {\n\tpub fn new(action: &Action, core: &'a mut Core, term: &'a mut Option<Raterm>) -> Result<Self> {\n\t\tlet tab = if let Ok(id) = action.get::<Id>(\"tab\") {\n\t\t\tcore.mgr.tabs.idx(id).ok_or_else(|| anyhow!(\"Tab with id {id} not found\"))?\n\t\t} else {\n\t\t\tcore.mgr.tabs.cursor\n\t\t};\n\n\t\tOk(Self {\n\t\t\tcore,\n\t\t\tterm,\n\t\t\ttab,\n\t\t\tlevel: 0,\n\t\t\tsource: action.source,\n\t\t\t#[cfg(debug_assertions)]\n\t\t\tbacktrace: vec![],\n\t\t})\n\t}\n\n\tpub(crate) fn with<F, T>(&mut self, tab: usize, f: F) -> T\n\twhere\n\t\tF: FnOnce(&mut Self) -> T,","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/sxyazi/yazi/blob/a541adde4e5b082719a0f21a87eb3eab071ece58/yazi-actor/src/context.rs#L14-L50","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nrx.send(Action::new(\"tab_switch\", tab_id))?\n// after\nif core.mgr.tabs.idx(tab_id).is_some() {\n    rx.send(Action::new(\"tab_switch\", tab_id))?;\n}","handlingStrategy":"validation","validationCode":"// Rust plugin/action dispatch site\nif let Ok(id) = action.get::<Id>(\"tab\") {\n    if core.mgr.tabs.idx(id).is_none() {\n        return; // skip stale tab\n    }\n}","typeGuard":null,"tryCatchPattern":"match Ctx::new(&action, core, term) {\n    Ok(ctx) => { /* handle */ }\n    Err(e) if e.to_string().contains(\"not found\") => { /* tab vanished; ignore or refresh */ }\n    Err(e) => return Err(e),\n}","preventionTips":["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."],"tags":["tab","actor","invalid-id"],"backgroundTag":"entity-not-found","analyzedSha":"a541adde4e5b082719a0f21a87eb3eab071ece58","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}