{"record":{"id":"9e2510ee070ab2c5","repo":"sxyazi/yazi","slug":"invalid-tx-in-showform","errorCode":null,"errorMessage":"Invalid 'tx' in ShowForm","messagePattern":"Invalid 'tx' in ShowForm","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-parser/src/pick/show.rs","lineNumber":22,"sourceCode":"use 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":4,"sourceCodeEnd":36,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-parser/src/pick/show.rs#L4-L36","documentation":"ShowForm also requires a `tx` field (the transmit/channel payload for the shown result). TryFrom<ActionCow> bails when `tx` is missing; both `cfg` and `tx` must be present for the show action to be valid.","triggerScenarios":"Emitting a `show` action with `cfg` set but no `tx` key, e.g. `ya.emit('show', { cfg = cfg })`.","commonSituations":"Partial refactors of plugin code that add cfg but forget tx; copies of an older show call that predates the tx field.","solutions":["Include the `tx` payload key alongside cfg: `show({ cfg = cfg, tx = tx })`","Check the API docs for the current ShowForm field set and update the call site","Confirm the sender serializes tx (not omitted as nil)"],"exampleFix":"// before\nya.emit('show', { cfg = cfg })\n// after\nya.emit('show', { cfg = cfg, tx = tx })","handlingStrategy":"validation","validationCode":"assert(tx ~= nil, \"show requires 'tx'\")\nya.emit('show', { cfg = cfg, tx = tx })","typeGuard":"local function is_valid_show(opts)\n  return type(opts) == \"table\" and opts.cfg ~= nil and opts.tx ~= nil\nend","tryCatchPattern":null,"preventionTips":["Always transmit tx alongside cfg for show actions","Update call sites when the ShowForm schema gains required fields","Serialize payloads explicitly rather than constructing by hand"],"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"}