sxyazi/yazi · error

Unwinding must be enabled for Windows. Please use `cargo…

Error message

Unwinding must be enabled for Windows. Please use `cargo build --profile release-windows --locked` instead to build Yazi.

What it means

This panic fires in yazi-fm's build script when the OUT_DIR path looks like a default Windows release build (`\release\build\yazi-fm-`). The default Windows release profile disables unwinding, which Yazi requires for its control flow. The build must use the repo's `release-windows` profile instead.

Solutions

  1. Build with `cargo build --profile release-windows --locked` as the error message instructs.
  2. If installing via cargo, use `cargo install --path yazi-fm --profile release-windows --locked` rather than the default release profile.
  3. Alternatively use an official prebuilt Windows binary.

Example fix

// before
cargo build --release

// after
cargo build --profile release-windows --locked
Defensive patterns

Strategy: validation

Validate before calling

# Verify the profile exists before building
grep -q 'profile.release-windows' Cargo.toml || echo 'run builds via the release-windows profile'

Prevention

When it happens

Trigger: Running `cargo build --release` (or `cargo install` which builds in a temp `release` dir) on Windows with the default release profile, so OUT_DIR matches `\release\build\yazi-fm-`.

Common situations: Windows users compiling Yazi themselves with `cargo build --release` instead of the documented command; `cargo install` creating temp release dirs (e.g. `cargo-install...\release\build\yazi-fm-...`).

Related errors


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

Appendix: source

Thrown at yazi-fm/build.rs:13

use std::env;

fn main() {
	let dir = env::var("OUT_DIR").unwrap();

	// cargo build
	//   C:\Users\Ika\Desktop\yazi\target\release\build\yazi-fm-cfc94820f71daa30\out
	// cargo install
	//   C:\Users\Ika\AppData\Local\Temp\cargo-installTFU8cj\release\build\
	// yazi-fm-45dffef2500eecd0\out

	if dir.contains(r"\release\build\yazi-fm-") {
		panic!(
			"Unwinding must be enabled for Windows. Please use `cargo build --profile release-windows --locked` instead to build Yazi."
		);
	}

	let manifest = env::var_os("CARGO_MANIFEST_DIR").unwrap().to_string_lossy().replace(r"\", "/");
	if manifest.contains("/git/checkouts/yazi-")
		|| manifest.contains("/registry/src/index.crates.io-")
	{
		panic!(
			"Due to Cargo's limitations, Yazi on crates.io must be built with `cargo install --force yazi-build`"
		);
	}
}

View on GitHub (pinned to a541adde4e)