sxyazi/yazi · error
Invalid 'tx' in ShowForm
Error message
Invalid 'tx' in ShowForm
What it means
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.
Source
Thrown at yazi-parser/src/pick/show.rs:22
use yazi_config::popup::PickCfg;
use yazi_shared::event::ActionCow;
#[derive(Debug)]
pub struct ShowForm {
pub cfg: PickCfg,
pub tx: mpsc::UnboundedSender<Option<usize>>,
}
impl TryFrom<ActionCow> for ShowForm {
type Error = anyhow::Error;
fn try_from(mut a: ActionCow) -> Result<Self, Self::Error> {
let Some(cfg) = a.take_any("cfg") else {
bail!("Invalid 'cfg' in ShowForm");
};
let Some(tx) = a.take_any("tx") else {
bail!("Invalid 'tx' in ShowForm");
};
Ok(Self { cfg, tx })
}
}
impl FromLua for ShowForm {
fn from_lua(_: Value, _: &Lua) -> mlua::Result<Self> { Err("unsupported".into_lua_err()) }
}
impl IntoLua for ShowForm {
fn into_lua(self, _: &Lua) -> mlua::Result<Value> { Err("unsupported".into_lua_err()) }
}
View on GitHub (pinned to 5f901b886b)
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)
Example fix
// before
ya.emit('show', { cfg = cfg })
// after
ya.emit('show', { cfg = cfg, tx = tx }) Defensive patterns
Strategy: validation
Validate before calling
assert(tx ~= nil, "show requires 'tx'")
ya.emit('show', { cfg = cfg, tx = tx }) Type guard
local function is_valid_show(opts) return type(opts) == "table" and opts.cfg ~= nil and opts.tx ~= nil end
Prevention
- 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
When it happens
Trigger: Emitting a `show` action with `cfg` set but no `tx` key, e.g. `ya.emit('show', { cfg = cfg })`.
Common situations: Partial refactors of plugin code that add cfg but forget tx; copies of an older show call that predates the tx field.
Related errors
- either name or interactive must be specified in TabRenameFor
- Invalid 'op' in UpdateFilesForm
- Invalid 'cfg' in ShowForm
- Invalid 'summary' in UpdateProgressForm
- Invalid 'cfg' in ShowForm
AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02).
Data as JSON: /api/errors/9e2510ee070ab2c5.
Report an issue: GitHub.