sxyazi/yazi · error · anyhow::Error

Failed to join new name with CWD

Error message

Failed to join new name with CWD

What it means

Thrown by Payload::from_str (yazi-dds/src/payload.rs:70) while parsing the inter-process DDS message wire format `kind,receiver,sender,body` (splitn on 4 comma-separated parts). The fourth part — the serialized Ember body — is missing, i.e. the string has fewer than four segments. Earlier segments missing would yield `empty kind`/`invalid receiver`/`invalid sender` instead; this error specifically means the first three parsed but the body is absent.

Source

Thrown at yazi-actor/src/mgr/create.rs:43

		let cwd = cx.cwd().to_owned();

		let mut target: Pin<Box<dyn Stream<Item = StrandBuf> + Send>> = if target.is_empty() {
			let input = input!(cx, YAZI.input.create(dir))?;
			Box::pin(
				UnboundedReceiverStream::new(input).filter_map(|event| async { event.map(Into::into) }),
			)
		} else {
			Box::pin(tokio_stream::iter(vec![target]))
		};

		tokio::spawn(async move {
			let Some(name) = target.next().await else { return Ok(()) };
			if name.is_empty() {
				return Ok(());
			}

			let Ok(new) = cwd.try_join(&name) else {
				bail!("Failed to join new name with CWD");
			};

			if !force
				&& let Some(file) = File::maybe_new(&new).await?
				&& !ConfirmProxy::show(ConfirmCfg::overwrite(&file)).await
			{
				return Ok(());
			}

			let end_sep = AnyAsciiChar::SEP.predicate(*name.encoded_bytes().last().unwrap());
			Self::r#do(new, dir || end_sep).await
		});
		succ!();
	}
}

impl Create {
	async fn r#do(new: UrlBuf, dir: bool) -> Result<()> {

View on GitHub (pinned to 441b332de8)

Solutions

  1. Emit the full four-part frame: `kind,receiver,sender,json-body` — ensure the JSON body is present even if it is `{}`
  2. If publishing from a script/tool, reuse yazi's Display format rather than hand-building the string
  3. Check for truncation: bodies are single-line JSON; a newline split will produce a head-only line on the next read
  4. Align yazi versions on both ends of the DDS stream so kinds and bodies match

Example fix

# before
echo 'hi,0,1234' | yazi  # missing body part
# after
echo 'hi,0,1234,{}' | yazi
Defensive patterns

Strategy: validation

Validate before calling

// Rust: validate frame shape before parsing
let n = line.match_indices(',').count();
if n < 3 { /* log and skip malformed frame */ }

Type guard

// Rust
fn is_valid_frame(s: &str) -> bool { s.splitn(4, ',').count() == 4 }

Try / catch

// Rust
match s.parse::<Payload>() {
    Ok(p) => handle(p),
    Err(e) => tracing::warn!("dropping malformed DDS frame: {e:#}"),
}

Prevention

When it happens

Trigger: A line read from the DDS stdout stream (yazi-to-yazi communication) containing only `kind,receiver,sender` or a trailing comma with nothing after it; hand-crafted `ya pub`-style messages or test harnesses writing malformed frames; truncation of a message in a pipe; a body containing raw commas is fine (splitn(4)) but an empty body is not.

Common situations: Custom external tools publishing to the DDS topic stream with a wrong frame layout; version mismatch between yazi instances exchanging events when an Ember kind stopped carrying a body; shell scripts echoing partial frames into the message bus.

Related errors


AI-assisted analysis of sxyazi/yazi@441b332de8 (2026-08-19). Data as JSON: /api/errors/c166b1aa07fa6d37. Report an issue: GitHub.