tauri-apps/tauri · error

failed to write checked_features file

Error message

failed to write checked_features file

What it means

The tauri crate's own build script writes the comma-separated list of checked ACL features to $OUT_DIR/checked_features. The expect fires when that write fails: OUT_DIR missing or unwritable, read-only target directory, disk full, or Windows path/antivirus interference.

Source

Thrown at crates/tauri/build.rs:275

  let dev = !custom_protocol;
  alias("custom_protocol", custom_protocol);
  alias("dev", dev);

  println!("cargo:dev={dev}");

  let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
  let mobile = target_os == "ios" || target_os == "android";
  alias("desktop", !mobile);
  alias("mobile", mobile);

  let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());

  let checked_features_out_path = out_dir.join("checked_features");
  std::fs::write(
    checked_features_out_path,
    CHECKED_FEATURES.get().unwrap().lock().unwrap().join(","),
  )
  .expect("failed to write checked_features file");

  // workaround needed to prevent `STATUS_ENTRYPOINT_NOT_FOUND` error in tests
  // see https://github.com/tauri-apps/tauri/pull/4383#issuecomment-1212221864
  let target_env = std::env::var("CARGO_CFG_TARGET_ENV");
  let is_tauri_workspace = std::env::var("__TAURI_WORKSPACE__").is_ok_and(|v| v == "true");
  if is_tauri_workspace && target_os == "windows" && Ok("msvc") == target_env.as_deref() {
    embed_manifest_for_tests();
  }

  if target_os == "android" {
    fn env_var(var: &str) -> String {
      std::env::var(var).unwrap_or_else(|_| {
        panic!("`{var}` is not set, which is needed to generate the kotlin files for android.")
      })
    }

    if let Ok(kotlin_out_dir) = std::env::var("WRY_ANDROID_KOTLIN_FILES_OUT_DIR") {
      let package = env_var("WRY_ANDROID_PACKAGE");

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Make the target directory writable and ensure free disk space.
  2. Run cargo clean to clear possibly corrupted state.
  3. On Windows: enable long-path support or move the project to a shorter path; exclude target/ from antivirus scanning.
Defensive patterns

Strategy: validation

Validate before calling

// fail fast with a clear message if OUT_DIR is not writable
let out = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
std::fs::create_dir_all(&out).expect("OUT_DIR missing/unwritable - check target dir permissions and disk space");
std::fs::write(out.join(".probe"), b"").and_then(|_| std::fs::remove_file(out.join(".probe")))
    .expect("OUT_DIR is not writable");

Prevention

When it happens

Trigger: Building the tauri crate in an environment where target/ is read-only or full: hardened CI containers, sandboxed runners, exceeded disk quota, antivirus locking freshly created files on Windows.

Common situations: CI with read-only workspace caches; disk-full runners; extremely deep target/ paths on Windows.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/81829fac4d6b2449. Report an issue: GitHub.