tauri-apps/tauri · error

failed to create core:default permissions directory

Error message

failed to create core:default permissions directory

What it means

Panic in define_default_permission_set when fs::create_dir_all fails to create <OUT_DIR>/permissions, the directory where the core:default permission set (default.toml) is generated. OUT_DIR is cargo's build output dir for the crate, so failure usually indicates an environment/filesystem problem rather than bad configuration.

Solutions

  1. Delete the target directory (or cargo clean) and rebuild to recreate OUT_DIR
  2. Fix ownership/permissions of the target directory for the current build user
  3. Ensure only one build process uses the target directory at a time
  4. Verify the build volume is writable and has free space

Example fix

// before
sudo chown -R root:root target
// after
sudo chown -R $(whoami) target
cargo clean
Defensive patterns

Strategy: validation

Validate before calling

let dir = std::path::Path::new(&out_dir);
assert!(dir.is_dir(), "OUT_DIR missing: {}", dir.display());
let target = dir.join("permissions");
fs::create_dir_all(&target).expect("cannot create OUT_DIR/permissions");
let probe = target.join(".write-test");
std::fs::write(&probe, b"").expect("not writable");
let _ = std::fs::remove_file(&probe);

Prevention

When it happens

Trigger: OUT_DIR missing or deleted mid-build, target directory owned by another user, read-only filesystem, or a regular file occupying the OUT_DIR/permissions path.

Common situations: Concurrent cargo builds sharing one target directory, builds run with sudo after earlier user builds, CI runners with odd permission setups, or disk-full conditions.

Understand the failure class

Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.

Related errors


AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18). Data as JSON: /api/errors/8ab9c11c24bd7b7b. Report an issue: GitHub.

Appendix: source

Thrown at crates/tauri/build.rs:448

      &docs_out_dir,
      plugin.strip_prefix("tauri-plugin-").unwrap_or(plugin),
    )
    .expect("failed to generate plugin documentation page");
    all_permissions.insert(plugin.to_string(), permissions);
  }

  let default_permissions = define_default_permission_set(out_dir);
  all_permissions.insert("core".to_string(), default_permissions);

  all_permissions
}

fn define_default_permission_set(
  out_dir: &Path,
) -> Vec<tauri_utils::acl::manifest::PermissionFile> {
  let permissions_out_dir = out_dir.join("permissions");
  fs::create_dir_all(&permissions_out_dir)
    .expect("failed to create core:default permissions directory");

  let default_toml = permissions_out_dir.join("default.toml");
  let toml_content = format!(
    r#"{LICENSE_HEADER}

[default]
description = "Default core plugins set."
permissions = [{}]
"#,
    PLUGINS
      .iter()
      .map(|(k, _)| format!("\"{k}:default\""))
      .collect::<Vec<_>>()
      .join(",")
  );

  write_if_changed(default_toml, toml_content)
    .unwrap_or_else(|_| panic!("unable to autogenerate core:default set"));

View on GitHub (pinned to 460ec35447)