{"record":{"id":"cb23db986b4b5d1c","repo":"sxyazi/yazi","slug":"invalid-cfg-in-showform-cb23db","errorCode":null,"errorMessage":"Invalid 'cfg' in ShowForm","messagePattern":"Invalid 'cfg' in ShowForm","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-parser/src/pick/show.rs","lineNumber":18,"sourceCode":"use anyhow::bail;\nuse mlua::{ExternalError, FromLua, IntoLua, Lua, Value};\nuse tokio::sync::mpsc;\nuse yazi_config::popup::PickCfg;\nuse yazi_shared::event::ActionCow;\n\n#[derive(Debug)]\npub struct ShowForm {\n\tpub cfg: PickCfg,\n\tpub tx:  mpsc::UnboundedSender<Option<usize>>,\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(tx) = a.take_any(\"tx\") else {\n\t\t\tbail!(\"Invalid 'tx' in ShowForm\");\n\t\t};\n\n\t\tOk(Self { cfg, tx })\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":36,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-parser/src/pick/show.rs#L1-L36","documentation":"ShowForm (the `pick.show`/show action for the picker) requires a `cfg` field containing the configuration to display. TryFrom<ActionCow> bails when `cfg` is absent from the action payload, since showing without a config payload is meaningless.","triggerScenarios":"Emitting a `show` action without the `cfg` payload key, e.g. `ya.emit('show', { tx = ... })` or `Pick:show({})`.","commonSituations":"Plugin authors constructing show actions manually and forgetting the config table; serializing/deserializing across the IPC boundary where cfg was dropped.","solutions":["Include the `cfg` payload key with the config value: `show({ cfg = cfg, tx = tx })`","Verify the source that built the action actually serializes cfg (not omitted as nil)","Check for typos such as `config` instead of `cfg`"],"exampleFix":"// before\nya.emit('show', { tx = tx })\n// after\nya.emit('show', { cfg = cfg, tx = tx })","handlingStrategy":"validation","validationCode":"assert(cfg ~= nil, \"show requires 'cfg'\")\nya.emit('show', { cfg = cfg, tx = tx })","typeGuard":"local function is_valid_show(opts)\n  return type(opts) == \"table\" and opts.cfg ~= nil\nend","tryCatchPattern":null,"preventionTips":["Include both cfg and tx in every show payload","Watch for nil values silently dropped by Lua tables","Check for cfg/config naming mismatches"],"tags":["plugin-api","validation","action-payload"],"backgroundTag":"missing-required-action-field","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"}