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

`{}` not found; required for generating a Windows Resource f

Error message

`{}` not found; required for generating a Windows Resource file during tauri-build

What it means

On Windows targets tauri-build embeds a Windows Resource (version info plus icon) using the winres machinery, and it requires the window icon file - derived from the bundle.icon configuration, by default src-tauri/icons/icon.ico - to exist. If window_icon_path is absent, the resource generation step aborts before res.compile() with this error naming the missing path.

Source

Thrown at crates/tauri-build/src/lib.rs:717

    });

    res.set("CompanyName", &company_name);

    let file_description = config
      .product_name
      .or_else(|| manifest.package.as_ref().map(|p| p.name.clone()))
      .or_else(|| std::env::var("CARGO_PKG_NAME").ok());

    res.set("FileDescription", &file_description.unwrap());

    if let Some(copyright) = &config.bundle.copyright {
      res.set("LegalCopyright", copyright);
    }

    if window_icon_path.exists() {
      res.set_icon_with_id(&window_icon_path.display().to_string(), "32512");
    } else {
      return Err(anyhow!(format!(
        "`{}` not found; required for generating a Windows Resource file during tauri-build",
        window_icon_path.display()
      )));
    }

    res.compile().with_context(|| {
      format!(
        "failed to compile `{}` into a Windows Resource file during tauri-build",
        window_icon_path.display()
      )
    })?;

    let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap();
    match target_env.as_str() {
      "gnu" => {
        let target_arch = match env::var("CARGO_CFG_TARGET_ARCH").unwrap().as_str() {
          "x86_64" => Some("x64"),
          "x86" => Some("x86"),

View on GitHub (pinned to 2f1cd75b0f)

Solutions

  1. Generate a full icon set from a source image: npm run tauri icon path/to/app-icon.png (creates src-tauri/icons including icon.ico)
  2. Or place a valid .ico file at the exact path printed in the error (default src-tauri/icons/icon.ico)
  3. Verify bundle.icon in tauri.conf.json points at an existing .ico file and commit icons to the repository

Example fix

# before: src-tauri/icons/icon.ico missing -> build fails

# after
npm run tauri icon ./app-icon.png  # regenerates src-tauri/icons/icon.ico
git add src-tauri/icons
Defensive patterns

Strategy: validation

Validate before calling

# prebuild check (Windows targets): icon.ico must exist
[ -f src-tauri/icons/icon.ico ] || npx tauri icon assets/app-icon.png

Prevention

When it happens

Trigger: Building for a Windows target (tauri build, or cargo build --target *-pc-windows-*) when the configured/default .ico file does not exist - fresh project without generated icons, custom bundle.icon path typo, or icons directory deleted/not committed.

Common situations: New repos missing the icons folder; CI checkouts excluding generated assets; moving icons without updating tauri.conf.json; overriding bundle.icon to a source PNG instead of a compiled .ico.

Related errors


AI-assisted analysis of tauri-apps/tauri@2f1cd75b0f (2026-08-16). Data as JSON: /api/errors/cedd9625e71b390b. Report an issue: GitHub.