tauri-apps/tauri · error

No file found in {} matching {}

Error message

No file found in {} matching {}

What it means

`find_in_directory(path, glob_pattern)` walks one directory level with `std::fs::read_dir` and returns the first entry whose full path matches the glob. If no entry matches, it errors with the searched directory and the pattern. (Marked `#[allow(dead_code)]` — an internal helper reached only from call sites that use it.)

Source

Thrown at crates/tauri-cli/src/helpers/fs.rs:50

  Ok(())
}

/// Find an entry in a directory matching a glob pattern.
/// Currently does not traverse subdirectories.
// currently only used on macOS
#[allow(dead_code)]
pub fn find_in_directory(path: &Path, glob_pattern: &str) -> crate::Result<PathBuf> {
  let pattern = glob::Pattern::new(glob_pattern)
    .with_context(|| format!("failed to parse glob pattern {glob_pattern}"))?;
  for entry in std::fs::read_dir(path)
    .with_context(|| format!("failed to read directory {}", path.display()))?
  {
    let entry = entry.context("failed to read directory entry")?;
    if pattern.matches_path(&entry.path()) {
      return Ok(entry.path());
    }
  }
  crate::error::bail!(
    "No file found in {} matching {}",
    path.display(),
    glob_pattern
  )
}

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. List the directory contents and compare against the pattern quoted in the error (`ls <path>`)
  2. Produce or restore the expected file (e.g. run the generator/build step that creates it)
  3. Rename your file to match the expected glob, or move it into the searched directory
Defensive patterns

Strategy: validation

Validate before calling

# ensure a file matching the expected glob exists before the step that needs it
ls src-tauri/icons/*.png >/dev/null 2>&1 || { echo 'expected icon glob matched nothing'; exit 1; }

Prevention

When it happens

Trigger: Any internal CLI flow that globs for a file (e.g. locating an icon or generated artifact by pattern such as `*.png` or `main*.rs`) in a directory that contains no matching file — typically because the file was not generated, was renamed, or the glob no longer matches the tool's output naming.

Common situations: Custom project layouts where generated files land under different names; upstream tooling renaming outputs so the hardcoded glob misses; empty directories after a clean.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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