tauri-apps/tauri · error · Error::GenericError
Permission already exists at {}
Error message
Permission already exists at {} What it means
`tauri permission new` computes the target permission file path; if a file already exists there, the CLI asks `overwrite?` (defaulting to No). Declining the prompt — or answering No in a non-interactive context — aborts with the path that collided.
Source
Thrown at crates/tauri-cli/src/acl/permission/new.rs:97
let permissions_dir = dir.join("permissions");
permissions_dir.join(format!(
"{}.{}",
permission.identifier,
options.format.extension()
))
}
};
if path.exists() {
let msg = format!(
"Permission already exists at {}",
dunce::simplified(&path).display()
);
let overwrite = prompts::confirm(&format!("{msg}, overwrite?"), Some(false))?;
if overwrite {
std::fs::remove_file(&path).fs_context("failed to remove permission file", path.clone())?;
} else {
crate::error::bail!(msg);
}
}
if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent).fs_context(
"failed to create permission directory",
parent.to_path_buf(),
)?;
}
std::fs::write(
&path,
options
.format
.serialize(&PermissionFile {
default: None,
set: Vec::new(),
permission: vec![permission],View on GitHub (pinned to 52e4b6e71d)
Solutions
- Choose a different, unused permission identifier when creating the new permission
- Answer Yes to the overwrite prompt if regenerating is intended (existing file is removed and rewritten)
- Delete or rename the existing file yourself before re-running the command
Example fix
# before tauri permission new # -> identifier: read-custom (file already exists, answered No) # after tauri permission new # -> identifier: read-custom-v2
Defensive patterns
Strategy: validation
Validate before calling
// before scaffolding, check the target permission file is free
import { access } from 'node:fs/promises';
const p = 'src-tauri/permissions/my-plugin/read-custom.toml';
try { await access(p); console.error(`${p} already exists — pick a new identifier`); process.exit(1); }
catch { /* free to create */ } Prevention
- Use unique, descriptive permission identifiers so filename collisions cannot happen
- Never hand-edit a scaffolded permission and then re-scaffold over it — answer No and edit instead
- Make scaffolding scripts idempotent: check file existence before calling `tauri permission new`
When it happens
Trigger: Running `tauri permission new` with an identifier/outlet that maps to an already existing file (e.g. creating `fs:read-custom` twice, or two permissions whose identifiers slugify to the same filename) and answering No (or letting the default No apply) to the overwrite prompt.
Common situations: Regenerating a permission after editing it by hand and not wanting to lose changes; rerunning a scaffolding script that is not idempotent; permission identifiers that differ only by characters dropped during filename generation.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
- invalid permission {p}
- You did not select any capabilities to update
- permission file not found, please build your application onc
- Couldn't find capabilities directory at {}
- Could not find a capability to update
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/33f631b42ad93d26.
Report an issue: GitHub.