{"record":{"id":"0fbee5f64cee34c6","repo":"sxyazi/yazi","slug":"invalid-opt-in-showform-0fbee5","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/input/show.rs","lineNumber":19,"sourceCode":"use anyhow::anyhow;\nuse mlua::{ExternalError, FromLua, IntoLua, Lua, Value};\nuse yazi_shared::event::ActionCow;\nuse yazi_widgets::input::InputOpt;\n\n#[derive(Debug, Default)]\npub struct ShowForm {\n\tpub opt: InputOpt,\n}\n\nimpl From<InputOpt> for ShowForm {\n\tfn from(opt: InputOpt) -> 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/input/show.rs#L1-L30","documentation":"The input component's show form mirrors the completion one: ShowForm::try_from takes an attached \"opt\" value (an InputOpt) from the Action. An action without that attachment fails with \"Invalid 'opt' in ShowForm\". FromLua/IntoLua are intentionally unsupported, so the form must come from Rust-side construction or a properly populated action.","triggerScenarios":"Emitting the input show action without .with_any(\"opt\", input_opt), or double-taking the \"opt\" key so the value is gone when the TryFrom conversion runs.","commonSituations":"Plugins opening the input prompt by emitting raw actions; code paths refactored so another consumer drains the attachment first.","solutions":["Construct the form directly: ShowForm::from(input_opt)","When emitting an action, always attach the option with .with_any(\"opt\", opt)","Audit for earlier take_any(\"opt\") calls on the same action"],"exampleFix":"// before\nlet form = ShowForm::try_from(action)?; // action has no \"opt\"\n\n// after\nlet form = ShowForm::from(opt); // construct directly from InputOpt","handlingStrategy":"validation","validationCode":"// Ensure the action carries the option before conversion:\nensure!(action.get::<InputOpt>(\"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 InputOpt with .with_any(\"opt\", opt) whenever emitting the action","Audit for earlier take_any(\"opt\") calls on the same action"],"tags":["input","forms","actions","opt"],"backgroundTag":null,"analyzedSha":"94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2","analyzedAt":"2026-08-16T09:56:24.836Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}