{"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/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-utils/src/acl/build.rs#L244-L280","documentation":"Panic in tauri-utils' ACL build helper used by plugin/app build scripts: autogenerate_command_permissions creates the output directory with fs::create_dir_all(path).expect(\"unable to create autogenerated commands dir\"). It fails when creation is refused — a file already exists at the same path, the checkout is read-only, permissions deny writes, or the disk is full.","triggerScenarios":"A plugin build.rs calling autogenerate_command_permissions with a path (typically <crate>/permissions/autogenerated) where a regular file named `autogenerated` exists, the source tree is mounted read-only, the build user lacks write permission, or ENOSPC.","commonSituations":"A stray committed file (no extension) named `autogenerated` inside permissions/; CI caching root-owned files after one privileged step; building from read-only source mounts; full disks on CI runners.","solutions":["Check what occupies the path: `ls -ld permissions/autogenerated` — if it is a file, remove it (`rm permissions/autogenerated`) and rebuild","Fix ownership/permissions so the build user can create directories in the crate","If the source tree is read-only, make it writable or relocate the permissions output path in the plugin's build.rs","Free disk space if creation fails with ENOSPC"],"exampleFix":"# before: permissions/autogenerated exists as a FILE → panic on create_dir_all\n\n# after\nfile permissions/autogenerated && rm permissions/autogenerated\ncargo build","handlingStrategy":"validation","validationCode":"// plugin build.rs pre-flight before autogenerate_command_permissions\nlet out = std::path::Path::new(\"permissions/autogenerated\");\nif out.exists() && !out.is_dir() {\n    panic!(\"a file occupies {} — remove it\", out.display());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add permissions/autogenerated to .gitignore and never commit a file at that path","Ensure the crate directory is writable by the build user","Fail fast in build.rs when the target path is occupied by a non-directory"],"tags":["acl","permissions","build","filesystem"],"backgroundTag":"build-dir-creation-failed","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}