{"record":{"id":"3de592e6ad627bc6","repo":"tauri-apps/tauri","slug":"project-directory-is-outdated-because-reason","errorCode":null,"errorMessage":"{} project directory is outdated because {reason}. Please delete {}, run `tauri {} init` and try again.","messagePattern":"(.+?) project directory is outdated because (.+?)\\. Please delete (.+?), run `tauri (.+?) init` and try again\\.","errorType":"exception","errorClass":"tauri_cli::error::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/mobile/mod.rs","lineNumber":577,"sourceCode":"                &format!(\"{xcodeproj_name}_iOS\"),\n                &format!(\"{}_iOS\", app.name()),\n              ),\n            )\n            .with_context(|| format!(\"failed to write {}\", pbxproj_path.display()))?;\n          } else {\n            project_outdated_reasons\n              .push(\"you have modified your [lib.name] or [package.name] in the Cargo.toml file\");\n          }\n        }\n      }\n\n      // note: pbxproj is synchronied by the dev/build commands\n    }\n  }\n\n  if !project_outdated_reasons.is_empty() {\n    let reason = project_outdated_reasons.join(\" and \");\n    crate::error::bail!(\n        \"{} project directory is outdated because {reason}. Please delete {}, run `tauri {} init` and try again.\",\n        target.ide_name(),\n        project_dir.display(),\n        target.command_name(),\n      )\n  }\n\n  Ok(())\n}\n\n#[cfg(unix)]\nfn ensure_gradlew(project_dir: &std::path::Path) -> Result<()> {\n  use std::os::unix::fs::PermissionsExt;\n\n  let gradlew_path = project_dir.join(\"gradlew\");\n  if let Ok(metadata) = gradlew_path.metadata() {\n    let mut permissions = metadata.permissions();\n    let is_executable = permissions.mode() & 0o111 != 0;","sourceCodeStart":559,"sourceCodeEnd":595,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/mobile/mod.rs#L559-L595","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Delete the stale generated directory (e.g. `rm -rf src-tauri/gen/android` or `src-tauri/gen/ios`).","Re-run `tauri android init` / `tauri ios init` to regenerate with current Cargo.toml values.","Re-apply any manual customizations you had made inside gen/ (signing configs, entitlements).","Avoid renaming `[lib.name]`/`package.name` casually; if you must, regenerate immediately after."],"exampleFix":"# before\n# Cargo.toml: [lib] name = \"old_name\" -> changed to \"new_name\"\ntauri ios dev\n# error: Xcode project directory is outdated because you have modified your [lib.name]...\n\n# after\nrm -rf src-tauri/gen/ios\ntauri ios init\ntauri ios dev","handlingStrategy":"fallback","validationCode":"# Detect drift: crate name vs generated project expectations\nLIB=$(grep -m1 '^name' src-tauri/Cargo.toml | cut -d'\"' -f2)\ngrep -rq \"$LIB\" src-tauri/gen/ios 2>/dev/null || echo \"gen project stale - regenerate it\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat `tauri <platform> init` as repeatable: after any crate/lib rename, delete gen/<platform> and re-init.","Keep manual gen/ customizations in a documented patch list so regeneration is cheap.","Add a CI consistency check comparing Cargo.toml names with the generated project."],"tags":["tauri-cli","mobile","init","stale-project","cargo-rename"],"backgroundTag":"stale-generated-project","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}