{"record":{"id":"0445f7290ef0e2b7","repo":"sxyazi/yazi","slug":"invalid-payload-in-updateyankedform","errorCode":null,"errorMessage":"Invalid payload in UpdateYankedForm","messagePattern":"Invalid payload in UpdateYankedForm","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-parser/src/mgr/update_yanked.rs","lineNumber":21,"sourceCode":"use anyhow::anyhow;\nuse mlua::{ExternalError, FromLua, IntoLua, Lua, Value};\nuse serde::{Deserialize, Serialize};\nuse yazi_shared::event::ActionCow;\n\n#[derive(Clone, Debug, Deserialize, Serialize)]\npub struct UpdateYankedForm<'a>(pub yazi_dds::ember::EmberYank<'a>);\n\nimpl<'a> Deref for UpdateYankedForm<'a> {\n\ttype Target = yazi_dds::ember::EmberYank<'a>;\n\n\tfn deref(&self) -> &Self::Target { &self.0 }\n}\n\nimpl TryFrom<ActionCow> for UpdateYankedForm<'_> {\n\ttype Error = anyhow::Error;\n\n\tfn try_from(mut a: ActionCow) -> Result<Self, Self::Error> {\n\t\ta.take_any(0).map(Self).ok_or_else(|| anyhow!(\"Invalid payload in UpdateYankedForm\"))\n\t}\n}\n\nimpl FromLua for UpdateYankedForm<'_> {\n\tfn from_lua(_: Value, _: &Lua) -> mlua::Result<Self> { Err(\"unsupported\".into_lua_err()) }\n}\n\nimpl IntoLua for UpdateYankedForm<'_> {\n\tfn into_lua(self, lua: &Lua) -> mlua::Result<Value> { self.0.into_lua(lua) }\n}\n","sourceCodeStart":3,"sourceCodeEnd":32,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-parser/src/mgr/update_yanked.rs#L3-L32","documentation":"UpdateYankedForm wraps the yank-state payload (position 0) sent when the yank status changes. TryFrom<ActionCow> takes the payload at index 0 via a.take_any(0); if it is absent or of the wrong type the error \"Invalid payload in UpdateYankedForm\" is raised. Unlike sibling forms it keys by position, not by name, so the payload must be the first extra value on the action.","triggerScenarios":"Dispatching mgr.update-yanked with no positional payload, or with the payload appended under a named key instead of index 0, or with an incompatible type.","commonSituations":"Custom code emitting update-yanked with the payload under a named key like 'opt' (mirroring other forms) instead of position 0; older emitters after the payload encoding changed in yazi.","solutions":["Pass the yank payload as the first positional extra value of the action (take_any(0)), not under a named key.","Ensure the payload type matches UpdateYankedForm<'_> (the yanked state struct) for your version.","Emit yank updates through the standard yank flow so the payload is encoded correctly.","Compare with yazi-parser/src/mgr/update_yanked.rs to confirm the expected payload shape."],"exampleFix":"// before\nlet a = ActionCow::from((\"mgr.update-yanked\", (\"payload\", payload))); // named key\n// after\nlet a = ActionCow::from((\"mgr.update-yanked\", payload)); // first positional value","handlingStrategy":"validation","validationCode":"// payload must be the FIRST positional extra value, not a named key\nif action.get_any(0).is_none() {\n    anyhow::bail!(\"update-yanked needs its payload at position 0\");\n}\nlet form = UpdateYankedForm::try_from(action)?;","typeGuard":"fn has_payload(a: &ActionCow) -> bool { a.get_any(0).is_some() }","tryCatchPattern":"let form = UpdateYankedForm::try_from(action)\n    .context(\"update-yanked payload must be the first positional value\")?;","preventionTips":["Do not mirror other forms by using a named key like 'opt' — this form reads position 0.","Emit yank updates through the yank subsystem helpers.","Confirm payload encoding against update_yanked.rs when refactoring."],"tags":["rust","action-parsing","missing-field","yazi"],"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-23T08:17:48.524Z"}