tauri-apps/tauri · error
unable to autogenerate default permissions
Error message
unable to autogenerate default permissions
What it means
During a plugin/app build, `define_permissions` autogenerates a `default.toml` permission file by writing it with `write_if_changed`. If the write fails, the build script panics. This is a filesystem failure while materializing autogenerated ACL permission files.
Solutions
- Check filesystem permissions on the crate's `permissions/` directory and make it writable for the build user.
- Ensure no other process (editor, antivirus, another cargo build) holds the default.toml file locked.
- Verify free disk space and that the build directory is not mounted read-only.
- Restore the `permissions/autogenerated` directory if it was deleted (git checkout / rebuild).
Example fix
// before chmod -w permissions/autogenerated // after chmod -R u+w permissions/ && cargo build
Defensive patterns
Strategy: validation
Validate before calling
# ensure permissions dir is writable before build [ -w permissions/autogenerated ] || chmod -R u+w permissions/
Prevention
- Build from a writable checkout; avoid read-only mounts in CI
- Reserve adequate disk space/quota on build machines
- Exclude source directories from antivirus/indexer file locking on Windows
When it happens
Trigger: `define_permissions` calls `write_if_changed(autogenerated/default.toml, default_toml)`; the write fails because the `permissions/autogenerated` directory is read-only, missing (creation failed earlier), the path is invalid, or the disk is full.
Common situations: Read-only source checkout or CI workspace; files locked by an editor/antivirus on Windows; building from a package manager cache with a read-only crate directory; disk quota exceeded.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- Permission not found, expected one of
- unable to autogenerate core:default set
- unable to autogenerate
- unable to create autogenerated commands dir
- Couldn't find capabilities directory at
AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18).
Data as JSON: /api/errors/3b64ba6f387d1f2e.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tauri/build.rs:409
let all_enable_by_default = if all_commands_enabled_by_default {
", which enables all commands"
} else {
""
};
let default_toml = format!(
r#"{LICENSE_HEADER}# Automatically generated - DO NOT EDIT!
[default]
description = "Default permissions for the plugin{all_enable_by_default}."
permissions = [{default_permissions}]
"#,
);
let out_path = autogenerated.join("default.toml");
write_if_changed(out_path, default_toml)
.unwrap_or_else(|_| panic!("unable to autogenerate default permissions"));
let permissions = tauri_utils::acl::build::define_permissions(
&PathBuf::from(glob::Pattern::escape(
&permissions_out_dir.to_string_lossy(),
))
.join("**")
.join("*.toml")
.to_string_lossy(),
&format!("tauri:{plugin}"),
out_dir,
|_| true,
)
.unwrap_or_else(|e| panic!("failed to define permissions for {plugin}: {e}"));
let docs_out_dir = Path::new("permissions")
.join(plugin_directory_name)
.join("autogenerated");
fs::create_dir_all(&docs_out_dir).expect("failed to create plugin documentation directory");View on GitHub (pinned to 460ec35447)