sxyazi/yazi · error

Expected custom payload of kind `{reply_kind}`

Error message

Expected custom payload of kind `{reply_kind}`

What it means

In `Dds::ask`, the client streams reply lines until it sees one whose kind matches the expected `reply_kind`; if such a line arrives but its payload is not an `Ember::Custom` body, it bails with `Expected custom payload of kind \`{reply_kind}\``. The reply envelope matched but the payload shape did not.

Source

Thrown at yazi-cli/src/dds/exec.rs:63

			Payload::new(EmberHi::borrowed([reply_kind])),
		)?;

		let (mut lines, mut writer) = Stream::connect().await?;
		writer.write_all(payload.as_bytes()).await?;
		writer.flush().await?;
		drop(writer);

		while let Ok(Some(line)) = lines.next_line().await {
			match line.split(',').next() {
				Some("hey") => {
					if let Ok(Ember::Hey(hey)) = Payload::from_str(&line).map(|p| p.body) {
						Self::ensure_version(Some(&hey.version))?;
						Self::ensure_ability(&hey.peers, kind, receiver)?;
					}
				}
				Some(kind) if kind == reply_kind => match Payload::from_str(&line)?.body {
					Ember::Custom(body) => return Ok(body.data),
					_ => bail!("Expected custom payload of kind `{reply_kind}`"),
				},
				_ => {}
			}
		}

		bail!("Connection closed before receiving reply")
	}
}

View on GitHub (pinned to 5f901b886b)

Solutions

  1. Restart all `yazi` and `ya` processes after upgrading either binary so both speak the same payload schema.
  2. Ensure only one compatible Yazi instance/peer set is reachable on the DDS connection.
  3. Check `Self::ensure_version` / peer ability output in debug logs to identify the mismatched peer.
Defensive patterns

Strategy: try-catch

Try / catch

match Dds::ask(...).await {
  Err(e) if e.to_string().starts_with("Expected custom payload") => {
    eprintln!("peer payload schema mismatch — restart all yazi/ya processes");
  }
  other => other,
}

Prevention

When it happens

Trigger: A reply with the expected kind arrives whose `Payload::from_str(...).body` is not `Ember::Custom` — e.g. a version/schema mismatch where the peer answers with a different Ember variant, or a proxy/mixed peer set answering with a non-custom payload of the same kind.

Common situations: `ya` and `yazi` versions diverging after an upgrade so the custom-reply encoding changed; another peer on the shared socket answering with an unexpected body type.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02). Data as JSON: /api/errors/a201e1395b82154d. Report an issue: GitHub.