{"record":{"id":"f366955052ee979f","repo":"tauri-apps/tauri","slug":"no-file-found-in-matching","errorCode":null,"errorMessage":"No file found in {} matching {}","messagePattern":"No file found in (.+?) matching (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/helpers/fs.rs","lineNumber":50,"sourceCode":"  Ok(())\n}\n\n/// Find an entry in a directory matching a glob pattern.\n/// Currently does not traverse subdirectories.\n// currently only used on macOS\n#[allow(dead_code)]\npub fn find_in_directory(path: &Path, glob_pattern: &str) -> crate::Result<PathBuf> {\n  let pattern = glob::Pattern::new(glob_pattern)\n    .with_context(|| format!(\"failed to parse glob pattern {glob_pattern}\"))?;\n  for entry in std::fs::read_dir(path)\n    .with_context(|| format!(\"failed to read directory {}\", path.display()))?\n  {\n    let entry = entry.context(\"failed to read directory entry\")?;\n    if pattern.matches_path(&entry.path()) {\n      return Ok(entry.path());\n    }\n  }\n  crate::error::bail!(\n    \"No file found in {} matching {}\",\n    path.display(),\n    glob_pattern\n  )\n}\n","sourceCodeStart":32,"sourceCodeEnd":56,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/helpers/fs.rs#L32-L56","documentation":"`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.)","triggerScenarios":"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.","commonSituations":"Custom project layouts where generated files land under different names; upstream tooling renaming outputs so the hardcoded glob misses; empty directories after a clean.","solutions":["List the directory contents and compare against the pattern quoted in the error (`ls <path>`)","Produce or restore the expected file (e.g. run the generator/build step that creates it)","Rename your file to match the expected glob, or move it into the searched directory"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# ensure a file matching the expected glob exists before the step that needs it\nls src-tauri/icons/*.png >/dev/null 2>&1 || { echo 'expected icon glob matched nothing'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the generator/build step that produces the globbed file before the step that consumes it","Do not rename generated outputs away from the names the tooling expects","After `git clean` or fresh clones, regenerate assets before running CLI commands that glob for them"],"tags":["tauri-cli","filesystem","glob","file-not-found","internal"],"backgroundTag":"file-not-found","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}