sxyazi/yazi · error

{cmd:?} exited with status {status}

Error message

{cmd:?} exited with status {status}

What it means

Generic wrapper for external commands spawned by `yazi-build` (cargo builds, etc.). `run()` executes the command with the workspace root as cwd; if the child process exits with a non-zero status, the `ensure!` fails with the command's debug representation and its exit status. The command spawned fine (spawn failures get a different context message) — the program itself failed.

Source

Thrown at yazi-build/src/common.rs:69

	let ext = if is_windows_target(target) { ".exe" } else { "" };
	copy_file(&from.join(format!("yazi{ext}")), &to.join(format!("yazi{ext}")))?;
	copy_file(&from.join(format!("ya{ext}")), &to.join(format!("ya{ext}")))?;
	Ok(())
}

pub(super) fn copy_file(from: &Path, to: &Path) -> Result<()> {
	fs::copy(from, to)
		.map(|_| ())
		.with_context(|| format!("failed to copy {} to {}", from.display(), to.display()))
}

pub(super) fn run(cmd: &mut Command) -> Result<()> {
	let status = cmd
		.current_dir(workspace_root()?)
		.status()
		.with_context(|| format!("failed to spawn {cmd:?}"))?;

	ensure!(status.success(), "{cmd:?} exited with status {status}");
	Ok(())
}

View on GitHub (pinned to 5f901b886b)

Solutions

  1. Read the compiler/cargo output printed above the error for the real failure
  2. Install the target toolchain with `rustup target add <triple>` if the target is missing
  3. Run `cargo update` or restore Cargo.lock if `--locked` reports a lockfile mismatch
  4. Run the failing cargo command manually from the workspace root to reproduce and fix compile/link errors

Example fix

// before (lockfile out of sync with Cargo.toml)
error: "cargo" "--config" ".cargo/release.toml" "build" "--locked" ... exited with status exit status: 101

// after
$ cargo update -p yazi-fm   # or remove --locked inconsistency
$ ya build
Defensive patterns

Strategy: try-catch

Validate before calling

# preflight checks before running ya build/dist
cargo --version && rustc --version
rustup target list --installed | grep -q <triple> || rustup target add <triple>
# ensure Cargo.lock is in sync
cargo metadata --locked --format-version 1 >/dev/null || cargo update --locked

Try / catch

try {
  execSync('ya build --target ' + triple, { stdio: 'inherit' });
} catch (err) {
  // the real cause is in the child's stderr printed above this error
  console.error('Build step failed; inspect cargo/compiler output above');
  throw err;
}

Prevention

When it happens

Trigger: Any `yazi-build` step invoking cargo or another tool that exits non-zero: compile errors during `ya build`/`ya dist`, `cargo build --locked` failing due to a Cargo.lock mismatch, the release config `.cargo/release.toml` being invalid, linker failures, or a custom `RUSTC`/`CARGO` binary failing.

Common situations: Missing target triple (target not installed via rustup); Cargo.lock out of date after editing Cargo.toml; compile error in the workspace; missing system linker for cross-compilation.

Related errors


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