sxyazi/yazi · error · anyhow::Error
invalid sender
Error message
invalid sender
What it means
The third comma-separated field of a DDS payload line is the sender id, parsed as u64 through Id::from_str just like the receiver. "invalid sender" fires when that field is missing (fewer than three comma-separated components) or is not a decimal u64.
Source
Thrown at yazi-dds/src/payload.rs:68
impl Payload<'static> {
pub(super) fn emit(self) {
emit!(Call(relay!(app:accept_payload).with_any("payload", self)));
}
}
impl FromStr for Payload<'static> {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let mut parts = s.splitn(4, ',');
let kind = parts.next().ok_or_else(|| anyhow!("empty kind"))?;
let receiver =
parts.next().and_then(|s| s.parse().ok()).ok_or_else(|| anyhow!("invalid receiver"))?;
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"))?
}
}View on GitHub (pinned to 94abcfa92f)
Solutions
- Emit the sender as a decimal u64 in field 3: `<kind>,<receiver>,<sender>,<body>`
- Verify the line has at least three commas before parsing when reading untrusted streams
- Generate test lines with Payload::to_string() rather than by hand
Example fix
// before
Payload::from_str("hover,0,self,{}")?;
// after
Payload::from_str("hover,0,12345,{}")?; Defensive patterns
Strategy: validation
Validate before calling
// Check field 3 parses as u64 before from_str: let f3 = line.splitn(4, ',').nth(2); ensure!(f3.is_some_and(|s| s.parse::<u64>().is_ok()), "invalid sender");
Type guard
fn valid_sender(s: &str) -> bool { s.parse::<u64>().is_ok() } Prevention
- Emit the sender as a decimal u64 in field 3
- Require at least three commas per line when reading untrusted streams
- Generate test lines programmatically, never by hand
When it happens
Trigger: Lines like `hover,0,abc,{...}` (non-numeric sender) or truncated input such as `hover,0` where the third field never arrives, so parts.next() fails to produce a parseable id.
Common situations: Truncated DDS lines from line-based transports; hand-written test messages missing a field; a writer emitting the instance id in a non-decimal format.
Related errors
AI-assisted analysis of sxyazi/yazi@94abcfa92f (2026-08-16).
Data as JSON: /api/errors/a9f783d22e2191ed.
Report an issue: GitHub.