tauri-apps/tauri · error

failed to create plugin documentation directory

Error message

failed to create plugin documentation directory

What it means

For each first-party plugin, the tauri build script generates ACL permission docs into permissions/<plugin>/autogenerated under the crate. The expect fires when fs::create_dir_all fails: a regular file already exists at that path (or a parent of it), or the filesystem denies directory creation.

Source

Thrown at crates/tauri/build.rs:433

      .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");
    tauri_utils::acl::build::generate_docs(
      &permissions,
      &docs_out_dir,
      plugin.strip_prefix("tauri-plugin-").unwrap_or(plugin),
    )
    .expect("failed to generate plugin documentation page");
    all_permissions.insert(plugin.to_string(), permissions);
  }

  let default_permissions = define_default_permission_set(out_dir);
  all_permissions.insert("core".to_string(), default_permissions);

  all_permissions
}

fn define_default_permission_set(
  out_dir: &Path,
) -> Vec<tauri_utils::acl::manifest::PermissionFile> {

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Inspect permissions/<plugin>/autogenerated in the offending crate: remove any file occupying that path so a directory can be created.
  2. Fix ownership/permissions of the source tree (e.g. chown after sudo builds).
  3. Build in an environment that permits writing to the source directory.

Example fix

# before: a regular file occupies the path
permissions/my-plugin/autogenerated  # <- file
rm permissions/my-plugin/autogenerated

# after: build recreates it as a directory
Defensive patterns

Strategy: validation

Validate before calling

let docs = std::path::Path::new("permissions").join(plugin_dir).join("autogenerated");
if docs.exists() && !docs.is_dir() {
    panic!("{} is a file; remove it so the docs directory can be created", docs.display());
}

Prevention

When it happens

Trigger: A file (not a directory) checked in at permissions/<plugin> or permissions/<plugin>/autogenerated in the plugin crate; building from a read-only source tree (e.g. files owned by root from previous sudo builds).

Common situations: Leftover artifacts committed by mistake; sudo-built directories now unwritable; read-only CI checkouts where docs are written into the source tree.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/c51e3a1d112754d6. Report an issue: GitHub.