{"record":{"id":"1e5ea2c62b7e9a9b","repo":"sxyazi/yazi","slug":"invalid-cfg-in-showform","errorCode":null,"errorMessage":"Invalid 'cfg' in ShowForm","messagePattern":"Invalid 'cfg' in ShowForm","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-parser/src/confirm/show.rs","lineNumber":17,"sourceCode":"use anyhow::bail;\nuse mlua::{ExternalError, FromLua, IntoLua, Lua, Value};\nuse yazi_config::popup::ConfirmCfg;\nuse yazi_shared::{CompletionToken, event::ActionCow};\n\n#[derive(Debug)]\npub struct ShowForm {\n\tpub cfg:   ConfirmCfg,\n\tpub token: CompletionToken,\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\tlet Some(cfg) = a.take_any(\"cfg\") else {\n\t\t\tbail!(\"Invalid 'cfg' in ShowForm\");\n\t\t};\n\n\t\tlet Some(token) = a.take_any(\"token\") else {\n\t\t\tbail!(\"Invalid 'token' in ShowForm\");\n\t\t};\n\n\t\tOk(Self { cfg, token })\n\t}\n}\n\nimpl From<Box<Self>> for ShowForm {\n\tfn from(value: Box<Self>) -> Self { *value }\n}\n\nimpl FromLua for ShowForm {\n\tfn from_lua(_: Value, _: &Lua) -> mlua::Result<Self> { Err(\"unsupported\".into_lua_err()) }\n}\n","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-parser/src/confirm/show.rs#L1-L35","documentation":"`ShowForm::try_from(ActionCow)` for the confirm dialog's `show` action extracts `\"cfg\"` with `a.take_any(\"cfg\")`; a missing `\"cfg\"` key aborts construction with this error. The cfg carries the dialog's content/configuration, so without it the dialog cannot be shown.","triggerScenarios":"Emitting a `confirm:show` ActionCow without a `\"cfg\"` entry, or under a wrong key/type so `take_any(\"cfg\")` returns None.","commonSituations":"Lua plugins calling the confirm plugin with missing arguments; typos like `config` instead of `cfg`; version drift where the payload key changed between yazi releases.","solutions":["Pass the confirm dialog configuration as `\"cfg\"` in the action payload.","Fix key typos (`cfg`, not `config` or `opts`).","Verify against the current confirm plugin API for how cfg is serialized into the action."],"exampleFix":"-- before (Lua)\nya.manager_emit(\"plugin\", { \"confirm\", args = { \"show\", token = tok } })\n-- after: include cfg\nya.manager_emit(\"plugin\", { \"confirm\", args = { \"show\", cfg = my_cfg, token = tok } })","handlingStrategy":"validation","validationCode":"assert!(action.get(\"cfg\").is_some(), \"confirm:show requires 'cfg'\");","typeGuard":"fn is_valid_show_action(a: &Action) -> bool {\n    a.get(\"cfg\").is_some()\n}","tryCatchPattern":"match ShowForm::try_from(action) {\n    Ok(form) => show(form),\n    Err(e) if e.to_string().contains(\"Invalid 'cfg'\") => {\n        eprintln!(\"confirm:show missing 'cfg': {e}\")\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Pass the dialog config under the exact key \"cfg\".","Wrap confirm-dialog emission in a helper that always populates cfg and token.","Diff your plugin against the current confirm plugin source when upgrading yazi."],"tags":["parser","confirm-dialog","action-payload","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"5f901b886b14de1f17460b6e52e9de5d67f8aba9","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}