{"record":{"id":"a765a680bef2e88f","repo":"sxyazi/yazi","slug":"invalid-opt-in-showform","errorCode":null,"errorMessage":"Invalid 'opt' in ShowForm","messagePattern":"Invalid 'opt' in ShowForm","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"yazi-parser/src/cmp/show.rs","lineNumber":19,"sourceCode":"use anyhow::anyhow;\nuse mlua::{ExternalError, FromLua, IntoLua, Lua, Value};\nuse yazi_core::cmp::CmpOpt;\nuse yazi_shared::event::ActionCow;\n\n#[derive(Clone, Debug)]\npub struct ShowForm {\n\tpub opt: CmpOpt,\n}\n\nimpl From<CmpOpt> for ShowForm {\n\tfn from(opt: CmpOpt) -> Self { Self { opt } }\n}\n\nimpl TryFrom<ActionCow> for ShowForm {\n\ttype Error = anyhow::Error;\n\n\tfn try_from(mut a: ActionCow) -> Result<Self, Self::Error> {\n\t\tOk(Self { opt: a.take_any(\"opt\").ok_or_else(|| anyhow!(\"Invalid 'opt' in ShowForm\"))? })\n\t}\n}\n\nimpl FromLua for ShowForm {\n\tfn from_lua(_: Value, _: &Lua) -> mlua::Result<Self> { Err(\"unsupported\".into_lua_err()) }\n}\n\nimpl IntoLua for ShowForm {\n\tfn into_lua(self, _: &Lua) -> mlua::Result<Value> { Err(\"unsupported\".into_lua_err()) }\n}\n","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/sxyazi/yazi/blob/94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2/yazi-parser/src/cmp/show.rs#L1-L30","documentation":"The completion component's show form is rebuilt from an in-process Action: ShowForm::try_from takes the attached \"opt\" value (a CmpOpt) with take_any(\"opt\"). If the action carries no such attachment, conversion fails with \"Invalid 'opt' in ShowForm\". The form is never constructed from Lua values (FromLua/IntoLua are deliberately unsupported).","triggerScenarios":"Emitting the completion show action manually — from a plugin or custom key binding — without attaching a CmpOpt, or a code path that already consumed the \"opt\" value before the TryFrom runs.","commonSituations":"Custom plugins trying to open the completion popup by hand; replaying serialized actions that lost their attachments.","solutions":["Build the form directly from the option: ShowForm::from(cmp_opt) instead of going through an Action","If emitting an action, attach the value: .with_any(\"opt\", opt)","Reuse the existing input/completion plumbing rather than hand-emitting internal actions"],"exampleFix":"// before\nlet form = ShowForm::try_from(action)?; // action has no \"opt\"\n\n// after\nlet form = ShowForm::from(opt); // construct directly from CmpOpt","handlingStrategy":"validation","validationCode":"// Ensure the action carries the option before conversion:\nensure!(action.get::<CmpOpt>(\"opt\").is_some(), \"show action requires an attached opt\");\nlet form = ShowForm::try_from(action)?;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer ShowForm::from(opt) over action round-trips","Attach CmpOpt with .with_any(\"opt\", opt) whenever emitting the action","Remember Lua cannot construct this form — FromLua is unsupported by design"],"tags":["completion","forms","actions","opt"],"backgroundTag":null,"analyzedSha":"94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2","analyzedAt":"2026-08-16T09:56:24.836Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}