tauri-apps/tauri · error

unable to create autogenerated commands dir

Error message

unable to create autogenerated commands dir

What it means

Panic in tauri-utils' ACL build helper used by plugin/app build scripts: autogenerate_command_permissions creates the output directory with fs::create_dir_all(path).expect("unable to create autogenerated commands dir"). It fails when creation is refused — a file already exists at the same path, the checkout is read-only, permissions deny writes, or the disk is full.

Source

Thrown at crates/tauri-utils/src/acl/build.rs:262

}

/// Permissions that are generated from commands using [`autogenerate_command_permissions`].
pub struct AutogeneratedPermissions {
  /// The allow permissions generated from commands.
  pub allowed: Vec<String>,
  /// The deny permissions generated from commands.
  pub denied: Vec<String>,
}

/// Autogenerate permission files for a list of commands.
pub fn autogenerate_command_permissions(
  path: &Path,
  commands: &[&str],
  license_header: &str,
  schema_ref: bool,
) -> AutogeneratedPermissions {
  if !path.exists() {
    fs::create_dir_all(path).expect("unable to create autogenerated commands dir");
  }

  let schema_entry = if schema_ref {
    let cwd = env::current_dir().unwrap();
    let components_len = path.strip_prefix(&cwd).unwrap_or(path).components().count();
    let schema_path = (1..components_len)
      .map(|_| "..")
      .collect::<PathBuf>()
      .join(PERMISSION_SCHEMAS_FOLDER_NAME)
      .join(PERMISSION_SCHEMA_FILE_NAME);
    format!(
      "\n\"$schema\" = \"{}\"\n",
      dunce::simplified(&schema_path)
        .display()
        .to_string()
        .replace('\\', "/")
    )
  } else {

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Check what occupies the path: `ls -ld permissions/autogenerated` — if it is a file, remove it (`rm permissions/autogenerated`) and rebuild
  2. Fix ownership/permissions so the build user can create directories in the crate
  3. If the source tree is read-only, make it writable or relocate the permissions output path in the plugin's build.rs
  4. Free disk space if creation fails with ENOSPC

Example fix

# before: permissions/autogenerated exists as a FILE → panic on create_dir_all

# after
file permissions/autogenerated && rm permissions/autogenerated
cargo build
Defensive patterns

Strategy: validation

Validate before calling

// plugin build.rs pre-flight before autogenerate_command_permissions
let out = std::path::Path::new("permissions/autogenerated");
if out.exists() && !out.is_dir() {
    panic!("a file occupies {} — remove it", out.display());
}

Prevention

When it happens

Trigger: A plugin build.rs calling autogenerate_command_permissions with a path (typically <crate>/permissions/autogenerated) where a regular file named `autogenerated` exists, the source tree is mounted read-only, the build user lacks write permission, or ENOSPC.

Common situations: A stray committed file (no extension) named `autogenerated` inside permissions/; CI caching root-owned files after one privileged step; building from read-only source mounts; full disks on CI runners.

Related errors


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