sxyazi/yazi · error
Invalid payload in UpdateYankedForm
Error message
Invalid payload in UpdateYankedForm
What it means
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.
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.
Example fix
// before
let a = ActionCow::from(("mgr.update-yanked", ("payload", payload))); // named key
// after
let a = ActionCow::from(("mgr.update-yanked", payload)); // first positional value Defensive patterns
Strategy: validation
Validate before calling
// payload must be the FIRST positional extra value, not a named key
if action.get_any(0).is_none() {
anyhow::bail!("update-yanked needs its payload at position 0");
}
let form = UpdateYankedForm::try_from(action)?; Type guard
fn has_payload(a: &ActionCow) -> bool { a.get_any(0).is_some() } Try / catch
let form = UpdateYankedForm::try_from(action)
.context("update-yanked payload must be the first positional value")?; Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid 'lock' in UpdatePeekedForm
- Invalid 'lock' in UpdateSpottedForm
- Invalid 'opt' in DisplaceDoForm
- Invalid 'opt' in OpenDoForm
- Invalid 'opt' in ProcessOpenForm
AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02).
Data as JSON: /api/errors/0445f7290ef0e2b7.
Report an issue: GitHub.
Appendix: source
Thrown at yazi-parser/src/mgr/update_yanked.rs:21
use anyhow::anyhow;
use mlua::{ExternalError, FromLua, IntoLua, Lua, Value};
use serde::{Deserialize, Serialize};
use yazi_shared::event::ActionCow;
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct UpdateYankedForm<'a>(pub yazi_dds::ember::EmberYank<'a>);
impl<'a> Deref for UpdateYankedForm<'a> {
type Target = yazi_dds::ember::EmberYank<'a>;
fn deref(&self) -> &Self::Target { &self.0 }
}
impl TryFrom<ActionCow> for UpdateYankedForm<'_> {
type Error = anyhow::Error;
fn try_from(mut a: ActionCow) -> Result<Self, Self::Error> {
a.take_any(0).map(Self).ok_or_else(|| anyhow!("Invalid payload in UpdateYankedForm"))
}
}
impl FromLua for UpdateYankedForm<'_> {
fn from_lua(_: Value, _: &Lua) -> mlua::Result<Self> { Err("unsupported".into_lua_err()) }
}
impl IntoLua for UpdateYankedForm<'_> {
fn into_lua(self, lua: &Lua) -> mlua::Result<Value> { self.0.into_lua(lua) }
}
View on GitHub (pinned to 5f901b886b)