tauri-apps/tauri · error · tauri_cli::error::Error

{} project directory is outdated because {reason}. Please de

Error message

{} project directory is outdated because {reason}. Please delete {}, run `tauri {} init` and try again.

What it means

The second stage of `ensure_init`: the generated project directory exists but checks detect it no longer matches the source of truth in your repo. Known reasons include modifying `[lib.name]` or `[package.name]` in Cargo.toml (the message joins all collected reasons with 'and'). Because the generated project embeds these names, Tauri requires regenerating it.

Source

Thrown at crates/tauri-cli/src/mobile/mod.rs:577

                &format!("{xcodeproj_name}_iOS"),
                &format!("{}_iOS", app.name()),
              ),
            )
            .with_context(|| format!("failed to write {}", pbxproj_path.display()))?;
          } else {
            project_outdated_reasons
              .push("you have modified your [lib.name] or [package.name] in the Cargo.toml file");
          }
        }
      }

      // note: pbxproj is synchronied by the dev/build commands
    }
  }

  if !project_outdated_reasons.is_empty() {
    let reason = project_outdated_reasons.join(" and ");
    crate::error::bail!(
        "{} project directory is outdated because {reason}. Please delete {}, run `tauri {} init` and try again.",
        target.ide_name(),
        project_dir.display(),
        target.command_name(),
      )
  }

  Ok(())
}

#[cfg(unix)]
fn ensure_gradlew(project_dir: &std::path::Path) -> Result<()> {
  use std::os::unix::fs::PermissionsExt;

  let gradlew_path = project_dir.join("gradlew");
  if let Ok(metadata) = gradlew_path.metadata() {
    let mut permissions = metadata.permissions();
    let is_executable = permissions.mode() & 0o111 != 0;

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Delete the stale generated directory (e.g. `rm -rf src-tauri/gen/android` or `src-tauri/gen/ios`).
  2. Re-run `tauri android init` / `tauri ios init` to regenerate with current Cargo.toml values.
  3. Re-apply any manual customizations you had made inside gen/ (signing configs, entitlements).
  4. Avoid renaming `[lib.name]`/`package.name` casually; if you must, regenerate immediately after.

Example fix

# before
# Cargo.toml: [lib] name = "old_name" -> changed to "new_name"
tauri ios dev
# error: Xcode project directory is outdated because you have modified your [lib.name]...

# after
rm -rf src-tauri/gen/ios
tauri ios init
tauri ios dev
Defensive patterns

Strategy: fallback

Validate before calling

# Detect drift: crate name vs generated project expectations
LIB=$(grep -m1 '^name' src-tauri/Cargo.toml | cut -d'"' -f2)
grep -rq "$LIB" src-tauri/gen/ios 2>/dev/null || echo "gen project stale - regenerate it"

Prevention

When it happens

Trigger: Renaming the crate or the `[lib] name` in src-tauri/Cargo.toml after `tauri <platform> init`; also other drift detected per-platform in `ensure_init` (e.g. AndroidGradle metadata changed). The check collects each mismatch and then bails with all reasons.

Common situations: Renaming the app package mid-development; applying a template rename script; pulling a commit where a teammate renamed the crate but kept gen/ committed; upgrading Tauri versions that changed expected gen contents.

Related errors


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