sxyazi/yazi · error · anyhow::Error
Missing 'payload' in Payload
Error message
Missing 'payload' in Payload
What it means
Besides the string form, Payload is reconstructed in-process from an Action (TryFrom<ActionCow>) by taking the attached "payload" value via take_any2("payload"). If the action was built without a payload attached — or the value was already consumed by an earlier take — conversion fails with "Missing 'payload' in Payload".
Source
Thrown at yazi-dds/src/payload.rs:84
let sender =
parts.next().and_then(|s| s.parse().ok()).ok_or_else(|| anyhow!("invalid sender"))?;
let body = parts.next().ok_or_else(|| anyhow!("empty body"))?;
Ok(Self { receiver, sender, body: Ember::from_str(kind, body)? })
}
}
impl<'a> From<Ember<'a>> for Payload<'a> {
fn from(value: Ember<'a>) -> Self { Self::new(value) }
}
impl TryFrom<ActionCow> for Payload<'_> {
type Error = anyhow::Error;
fn try_from(mut a: ActionCow) -> Result<Self, Self::Error> {
a.take_any2("payload").ok_or_else(|| anyhow!("Missing 'payload' in Payload"))?
}
}
impl Display for Payload<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let result = match &self.body {
Ember::Hi(b) => serde_json::to_string(b),
Ember::Hey(b) => serde_json::to_string(b),
Ember::Bye(b) => serde_json::to_string(b),
Ember::Cd(b) => serde_json::to_string(b),
Ember::Load(b) => serde_json::to_string(b),
Ember::Hover(b) => serde_json::to_string(b),
Ember::Tab(b) => serde_json::to_string(b),
Ember::Rename(b) => serde_json::to_string(b),
Ember::BulkRename(b) => serde_json::to_string(b),
Ember::Yank(b) => serde_json::to_string(b),
Ember::Duplicate(b) => serde_json::to_string(b),
Ember::Move(b) => serde_json::to_string(b),View on GitHub (pinned to 94abcfa92f)
Solutions
- Attach the payload when creating the action: relay!(app:accept_payload).with_any("payload", payload)
- Ensure exactly one consumer takes the "payload" value from the action
- Prefer constructing Payload directly (Payload::new / From<Ember>) instead of round-tripping through an Action
Example fix
// before
emit!(Call(relay!(app:accept_payload)));
// after
emit!(Call(relay!(app:accept_payload).with_any("payload", payload))); Defensive patterns
Strategy: validation
Validate before calling
// Ensure the action still carries the payload before converting:
ensure!(action.get::<Payload>("payload").is_some(), "action is missing its payload");
let p = Payload::try_from(action)?; Prevention
- Attach the payload at action-construction time with .with_any("payload", p)
- Allow exactly one consumer of the "payload" key per action
- Prefer direct Payload::new over round-tripping through actions
When it happens
Trigger: Emitting an accept_payload relay without .with_any("payload", payload), replaying a serialized action that lost its attachments, or a code path that calls take_any2/take_any("payload") before the TryFrom conversion runs.
Common situations: Custom plugins relaying payloads between components; refactors that move the conversion after another consumer of the same key.
Related errors
AI-assisted analysis of sxyazi/yazi@94abcfa92f (2026-08-16).
Data as JSON: /api/errors/a93be45ef028819a.
Report an issue: GitHub.