tauri-apps/tauri · error

Couldn't recognize the {} folder as a Tauri project. It must

Error message

Couldn't recognize the {} folder as a Tauri project. It must contain a `{}`, `{}` or `{}` file in any subfolder.

What it means

Panic in the Tauri CLI when it cannot locate the Tauri project. resolve_tauri_dir() honors the TAURI_APP_PATH env var, then checks the current directory and ./src-tauri, then recursively walks (default depth 3, adjustable via TAURI_CLI_CONFIG_DEPTH, honoring .gitignore/.taurignore) looking for tauri.conf.json / tauri.conf.json5 / Tauri.toml. Nothing found -> this panic naming the folder it searched.

Source

Thrown at crates/tauri-cli/src/helpers/app_paths.rs:133

  lookup(&src_dir, |path| {
    folder_has_configuration_file(Target::Linux, path) || is_configuration_file(Target::Linux, path)
  })
  .map(|p| {
    if p.is_dir() {
      log::debug!("Found Tauri project directory {}", p.display());
      p
    } else {
      log::debug!("Found Tauri project configuration file {}", p.display());
      p.parent().unwrap().to_path_buf()
    }
  })
}

pub fn resolve_dirs() -> Dirs {
  let tauri = TAURI_DIR.get_or_init(|| resolve_tauri_dir().unwrap_or_else(|| {
    let env_var_name = env_tauri_app_path().is_some().then(|| format!("`{ENV_TAURI_APP_PATH}`"));
    panic!("Couldn't recognize the {} folder as a Tauri project. It must contain a `{}`, `{}` or `{}` file in any subfolder.",
      env_var_name.as_deref().unwrap_or("current"),
      ConfigFormat::Json.into_file_name(),
      ConfigFormat::Json5.into_file_name(),
      ConfigFormat::Toml.into_file_name()
    )
  }));
  let frontend = FRONTEND_DIR.get_or_init(|| {
    resolve_frontend_dir().unwrap_or_else(|| tauri.parent().unwrap().to_path_buf())
  });
  Dirs { tauri, frontend }
}

pub fn resolve_frontend_dir() -> Option<PathBuf> {
  let frontend_dir =
    env_tauri_frontend_path().unwrap_or_else(|| current_dir().expect("failed to read cwd"));

  if frontend_dir.join("package.json").exists() {
    return Some(frontend_dir);

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Run the CLI from the directory that contains the config (usually src-tauri/) or its parent
  2. Export TAURI_APP_PATH=/abs/path/to/src-tauri (and TAURI_FRONTEND_PATH if needed) so the CLI resolves it explicitly
  3. Raise walk depth with TAURI_CLI_CONFIG_DEPTH, or make sure the config folder is not ignored by .gitignore (add a negation or .taurignore exception)

Example fix

# before
cd /repo && npx tauri dev   # panic: Couldn't recognize the current folder...

# after
export TAURI_APP_PATH=/repo/apps/desktop/src-tauri
npx tauri dev
# or: cd /repo/apps/desktop/src-tauri && npx tauri dev
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
found=$(find . -max-depth 4 -name 'tauri.conf.json' -o -name 'tauri.conf.json5' -o -name 'Tauri.toml' 2>/dev/null | head -1)
[ -n "$found" ] || { echo 'no Tauri config found; set TAURI_APP_PATH or cd into src-tauri'; exit 1; }

Prevention

When it happens

Trigger: Running any `tauri` subcommand from a directory that contains no Tauri config within the walk depth; the config folder being excluded by .gitignore; TAURI_APP_PATH set to a wrong directory; monorepo with the src-tauri crate nested deeper than 3 levels.

Common situations: Running the CLI from the repo root of a monorepo where src-tauri lives in apps/desktop/src-tauri; .gitignore rules swallowing the generated project dir; CI checking out only part of the repo.

Related errors


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