sxyazi/yazi · error · anyhow::Error

invalid receiver

Error message

invalid receiver

What it means

The second comma-separated field of a DDS payload line is the receiver id, parsed with Id::from_str (a u64). "invalid receiver" means that field is absent or does not parse as a decimal unsigned 64-bit integer. Receiver 0 broadcasts to all peers.

Source

Thrown at yazi-dds/src/payload.rs:65

	}
}

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> {

View on GitHub (pinned to 94abcfa92f)

Solutions

  1. Write the receiver as a plain decimal u64; use 0 to broadcast
  2. Strip quotes/whitespace around the id before formatting the line
  3. Template new lines on real Payload::to_string() output

Example fix

// before
Payload::from_str("hover,peer-1,42,{}")?;

// after (0 = broadcast to all peers)
Payload::from_str("hover,0,42,{}")?;
Defensive patterns

Strategy: validation

Validate before calling

// Check field 2 parses as u64 before from_str:
let f2 = line.splitn(4, ',').nth(1);
ensure!(f2.is_some_and(|s| s.parse::<u64>().is_ok()), "invalid receiver");

Type guard

fn valid_receiver(s: &str) -> bool { s.parse::<u64>().is_ok() }

Prevention

When it happens

Trigger: Lines like `hover,me,123,{...}` (non-numeric receiver), `hover,0x10,...` (hex not accepted), ids wrapped in quotes or whitespace, or a line truncated before the second field so parts.next() yields nothing parseable.

Common situations: Hand-crafted pubsub messages from scripts; tools emitting ids in hex or with padding; format drift between writer and reader of the DDS stream.

Related errors


AI-assisted analysis of sxyazi/yazi@94abcfa92f (2026-08-16). Data as JSON: /api/errors/5214c9094dbbe4ba. Report an issue: GitHub.