tauri-apps/tauri · error
unable to autogenerate
Error message
unable to autogenerate {out_path:?} What it means
autogenerate_command_permissions writes a default `<command>.toml` permissions file for each ACL command during the Tauri build script. If write_if_changed fails (unwritable directory, permission issue, out_path being a directory), it panics with `unable to autogenerate {out_path:?}`, halting the build script.
Solutions
- Ensure the permissions directory exists and is writable (chown/chmod the src-tauri tree)
- Delete a stray directory (or locked file) at the reported out_path
- Avoid sudo cargo builds that leave root-owned files; `sudo chown -R $USER src-tauri`
- Build outside read-only mounts or copy the repo to a writable location
Example fix
// before sudo cargo tauri build # leaves root-owned permissions dir // after sudo chown -R $USER:$USER src-tauri/permissions && cargo tauri build
Defensive patterns
Strategy: validation
Validate before calling
import os, sys, pwd
p = 'src-tauri/permissions'
if not os.access(p, os.W_OK) and not os.access(os.path.dirname(p) or '.', os.W_OK):
sys.exit(f'cannot write ACL permissions into {p}')
if os.path.isdir(os.path.join(p, 'allow-command.toml')):
sys.exit('toml path collides with a directory') Prevention
- Never run cargo builds with sudo; chown back any root-owned files
- Build in writable workspaces, not read-only mounts
- Add permissions-dir writability checks to CI setup
- Exclude src-tauri/permissions from tools that lock or quarantine files
When it happens
Trigger: Running cargo build where the ACL permissions target directory (e.g. src-tauri/permissions/<plugin>/ orgen dir) cannot be written: read-only checkout, file locked by another process, or a directory already existing at the .toml path.
Common situations: Building in a read-only container/CI checkout; the target file is checked out read-only or owned by root after sudo builds; a path collision where `<command>.toml` is a directory; antivirus locking the file on Windows.
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
- failed to generate plugin documentation page
- failed to create core:default permissions directory
- failed to create plugin documentation directory
- failed to resolve ACL
- failed to write checked_features file
AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18).
Data as JSON: /api/errors/c46a453c4056ee8a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tauri-utils/src/acl/build.rs:309
let toml = format!(
r###"{license_header}# Automatically generated - DO NOT EDIT!
{schema_entry}
[[permission]]
identifier = "allow-{slugified_command}"
description = "Enables the {command} command without any pre-configured scope."
commands.allow = ["{command}"]
[[permission]]
identifier = "deny-{slugified_command}"
description = "Denies the {command} command without any pre-configured scope."
commands.deny = ["{command}"]
"###,
);
let out_path = path.join(format!("{command}.toml"));
write_if_changed(&out_path, toml)
.unwrap_or_else(|_| panic!("unable to autogenerate {out_path:?}"));
autogenerated
.allowed
.push(format!("allow-{slugified_command}"));
autogenerated
.denied
.push(format!("deny-{slugified_command}"));
}
autogenerated
}
const PERMISSION_TABLE_HEADER: &str =
"## Permission Table\n\n<table>\n<tr>\n<th>Identifier</th>\n<th>Description</th>\n</tr>\n";
/// Generate a markdown documentation page containing the list of permissions of the plugin.
pub fn generate_docs(
permissions: &[PermissionFile],View on GitHub (pinned to 460ec35447)