{"record":{"id":"e03ff76a167da652","repo":"tauri-apps/tauri","slug":"unable-to-create-autogenerated-commands-dir","errorCode":null,"errorMessage":"unable to create autogenerated commands dir","messagePattern":"unable to create autogenerated commands dir","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-utils/src/acl/build.rs","lineNumber":262,"sourceCode":"}\n\n/// Permissions that are generated from commands using [`autogenerate_command_permissions`].\npub struct AutogeneratedPermissions {\n  /// The allow permissions generated from commands.\n  pub allowed: Vec<String>,\n  /// The deny permissions generated from commands.\n  pub denied: Vec<String>,\n}\n\n/// Autogenerate permission files for a list of commands.\npub fn autogenerate_command_permissions(\n  path: &Path,\n  commands: &[&str],\n  license_header: &str,\n  schema_ref: bool,\n) -> AutogeneratedPermissions {\n  if !path.exists() {\n    fs::create_dir_all(path).expect(\"unable to create autogenerated commands dir\");\n  }\n\n  let schema_entry = if schema_ref {\n    let cwd = env::current_dir().unwrap();\n    let components_len = path.strip_prefix(&cwd).unwrap_or(path).components().count();\n    let schema_path = (1..components_len)\n      .map(|_| \"..\")\n      .collect::<PathBuf>()\n      .join(PERMISSION_SCHEMAS_FOLDER_NAME)\n      .join(PERMISSION_SCHEMA_FILE_NAME);\n    format!(\n      \"\\n\\\"$schema\\\" = \\\"{}\\\"\\n\",\n      dunce::simplified(&schema_path)\n        .display()\n        .to_string()\n        .replace('\\\\', \"/\")\n    )\n  } else {","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-utils/src/acl/build.rs#L244-L280","documentation":"During the build (build.rs ACL codegen), Tauri auto-generates permission files for app commands in a target/permissions directory. If the directory does not exist, `fs::create_dir_all` is called; failure (permission, read-only FS, path occupied by a file) panics the build script with this message.","triggerScenarios":"Running `cargo build`/`tauri build` when the autogenerated permissions path cannot be created: parent dir not writable, disk full, the path (or a segment) exists as a regular file, or a hardened CI filesystem.","commonSituations":"Builds in read-only containers or sandboxes; `target/` checked into VCS with odd permissions; a file named like the permissions directory left by a previous bad build.","solutions":["Check and fix permissions on the build output directory (`target/`) so the build process can write.","Delete the offending path if a file occupies the permissions directory location (`rm -rf target` is the blunt option).","Ensure sufficient disk space and that no antivirus/sandbox blocks writes.","Run the build as a user with write access to the project."],"exampleFix":"// shell fix\nrm -rf src-tauri/target && cargo build","handlingStrategy":"validation","validationCode":"// before building, verify the output tree is writable\nlet p = std::path::Path::new(\"target\");\nassert!(p.exists() && !p.is_file(), \"target must be a writable dir\");\nlet probe = p.join(\".write-test\");\nstd::fs::write(&probe, b\"\").expect(\"target/ not writable\");\nlet _ = std::fs::remove_file(&probe);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep target/ writable by the build user; avoid read-only containers without a writable volume.","Do not commit build artifacts that could shadow the permissions directory.","Monitor disk space in CI."],"tags":["build","filesystem","permissions","codegen"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}