tauri-apps/tauri · error

unable to autogenerate {default_permission_path:?}

Error message

unable to autogenerate {default_permission_path:?}

What it means

Build-time panic in tauri-build's ACL machinery. After collecting the plugin's permission files it autogenerates a `default.toml` (a [default] permission aggregating them) into the plugin's output directory and calls write_if_changed; if that write fails the closure panics with the destination path. It is an environment/IO failure, not a content problem.

Source

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

        DefaultPermissionRule::Allow(permissions) => permissions,
      });
      if let Some(default_permissions) = default_permissions {
        let default_permissions = default_permissions
          .iter()
          .map(|p| format!("\"{p}\""))
          .collect::<Vec<String>>()
          .join(",");
        let default_permission = format!(
          r###"# Automatically generated - DO NOT EDIT!
[default]
permissions = [{default_permissions}]
"###
        );

        let default_permission_path = plugin_out_dir.join("default.toml");

        write_if_changed(&default_permission_path, default_permission)
          .unwrap_or_else(|_| panic!("unable to autogenerate {default_permission_path:?}"));
      }

      tauri_utils::acl::build::define_permissions(
        &PathBuf::from(glob::Pattern::escape(&plugin_out_dir.to_string_lossy()))
          .join("*")
          .to_string_lossy(),
        name,
        &plugin_out_dir,
        |_| true,
      )?
    };

    if let Some(pattern) = plugin.permissions_path_pattern {
      permission_files.extend(tauri_utils::acl::build::define_permissions(
        pattern,
        name,
        &plugin_out_dir,
        |_| true,

View on GitHub (pinned to dd6befda92)

Solutions

  1. Delete the stale generated permissions output (or `cargo clean`) and rebuild
  2. Fix ownership of the target directory: `sudo chown -R $(whoami) target` (or the whole workspace)
  3. Never run cargo/tauri as root; free disk space and exclude the target dir from antivirus/lockers

Example fix

# before: panic!("unable to autogenerate .../permissions/default.toml")
sudo cargo tauri build   # root-owned artifacts poison later builds

# after
cargo clean
cargo tauri build         # run as the normal user from now on
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
# run before cargo tauri build
dir="${CARGO_TARGET_DIR:-target}"
if [ -d "$dir" ] && [ ! -w "$dir" ]; then echo "target dir not writable (sudo build residue?)"; exit 1; fi

Prevention

When it happens

Trigger: The permissions output directory (under the cargo target/ build dir) is not writable: an earlier build ran under root/sudo and left root-owned files, the directory sits on a read-only or network filesystem, an antivirus/IDE has the file locked, or the disk is full.

Common situations: Mixed sudo/non-sudo cargo builds on Linux/macOS; CI caches restored with a different user; workspace vendored onto a read-only mount; CI runners out of disk space.

Related errors


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