tauri-apps/tauri · error

` ` not found; required for generating a Windows Resource…

Error message

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

What it means

While generating a Windows resource file, tauri-build embeds the window icon into the .res via set_icon_with_id; if the configured window icon file is missing the build fails with this error naming the expected path.

Solutions

  1. Create the icon at the expected path (default icons/icon.ico) e.g. via `cargo tauri icon`
  2. Fix the icon path in tauri.conf.json `bundle.icon` to point at the existing .ico
  3. Ensure icons are committed to version control so CI has them

Example fix

// before (tauri.conf.json)
"icon": ["icons/missing.ico"]
// after
"icon": ["icons/icon.ico"]  // run `cargo tauri icon app-icon.png` to generate
Defensive patterns

Strategy: validation

Validate before calling

const icons = cfg.bundle?.icon ?? [];
if (process.platform === 'win32' && !icons.some(i => i.endsWith('.ico') && fs.existsSync(resolve('src-tauri', i)))) {
  throw new Error('No existing .ico window icon configured; run `cargo tauri icon`');
}

Type guard

const hasWindowIcon = (cfg: Config) => (cfg.bundle?.icon ?? []).some(i => i.endsWith('.ico') && existsSync(join('src-tauri', i)));

Try / catch

try {
  await buildWindows();
} catch (e) {
  if (String(e).includes('not found; required for generating a Windows Resource file')) {
    throw new Error('Generate icons: cargo tauri icon app-icon.png');
  }
  throw e;
}

Prevention

When it happens

Trigger: Building for Windows (try_build -> build) when `bundle.icon` / the window icon path (typically icons/icon.ico) does not exist on disk.

Common situations: Fresh clone missing icons directory, icon path customized in tauri.conf.json but file renamed, or `create-tauri-app` scaffolding step skipped.

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@460ec35447 (2026-09-18). Data as JSON: /api/errors/cedd9625e71b390b. Report an issue: GitHub.

Appendix: source

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

    });

    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 460ec35447)