sxyazi/yazi · warning · anyhow::Error

Invalid path

Error message

Invalid path

What it means

During bulk file creation each edited entry is joined onto the working directory with cwd.try_join(entry.path). If the join fails — the entry cannot be represented as a valid relative path under cwd for that URL kind — the entry is skipped from creation and pushed onto the failed list, which is printed at the end of the run. The operation as a whole continues; only that entry is lost.

Source

Thrown at yazi-actor/src/mgr/bulk_create.rs:74

		});
		succ!()
	}
}

impl BulkCreate {
	async fn r#do(cwd: UrlBuf, todo: Vec<Entry<'_>>) -> Result<()> {
		writef!(TTY.writer(), "{EraseScreen}\n")?;
		if todo.is_empty() {
			return Ok(());
		} else if !Self::ask_continue(&todo, None)? {
			return Ok(()); // TODO: support `bulk_exit`?
		}

		let _permit = WATCHER.acquire().await.unwrap();
		let (mut failed, mut succeeded) = (vec![], Vec::with_capacity(todo.len()));
		for entry in todo {
			let Ok(dist) = cwd.try_join(entry.path) else {
				failed.push((entry, anyhow!("Invalid path")));
				continue;
			};

			let result: io::Result<()> = if entry.is_dir {
				engine::create_dir_all(&dist).await
			} else if let Some(parent) = dist.parent() {
				engine::create_dir_all(parent).await.ok();
				engine::create_new(&dist).await.map(|_| ())
			} else {
				Err(io::Error::other("No parent directory"))
			};

			if let Err(e) = result {
				failed.push((entry, e.into()));
			} else if let Ok(f) = engine::file(dist).await {
				succeeded.push(f);
			} else {
				failed.push((entry, anyhow!("Failed to retrieve file info")));

View on GitHub (pinned to 94abcfa92f)

Solutions

  1. Fix the flagged entries: keep each path relative to cwd and valid for that URL kind, then re-run
  2. Run bulk_create from the directory the paths are actually relative to
  3. Read the failed-pairs output after the run — it names exactly which entries were invalid

Example fix

// before (buffer line, absolute path)
/tmp/notes/todo.txt

// after (relative to cwd)
notes/todo.txt
Defensive patterns

Strategy: validation

Validate before calling

// Validate every entry before running bulk_create:
for entry in &todo {
    if cwd.try_join(entry.path).is_err() {
        return Err(anyhow!("entry `{}` is not a valid path under {}", entry.path, cwd));
    }
}

Prevention

When it happens

Trigger: A bulk_create buffer entry that is an absolute path, a path escaping cwd, contains bytes invalid for the URL kind's strand (NUL, invalid UTF-8), or mismatches the URL kind (local path under an archive/remote URL). cwd.try_join returns Err and the entry lands in failed.

Common situations: Editing the bulk-create buffer with an editor that absolutizes paths or inserts control characters; mixing entries across URL kinds; scripts generating the buffer with stray bytes.

Related errors


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