{"record":{"id":"226f2dc1037e7af6","repo":"denoland/deno","slug":"icon-not-found","errorCode":null,"errorMessage":"icon '{}' not found","messagePattern":"icon '(.+?)' not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/desktop.rs","lineNumber":1169,"sourceCode":"}\n\n/// Resolve `icon` (a `.png` or `.icns` path, possibly relative to\n/// `initial_cwd`) into an absolute path suitable for `LAUFEY_APP_ICON`, which\n/// laufey passes to `-[NSImage initWithContentsOfFile:]` (both formats are\n/// accepted, so no conversion is needed).\n#[cfg(target_os = \"macos\")]\nfn resolve_hmr_icon_path(\n  icon: &crate::args::IconConfig,\n  initial_cwd: &Path,\n) -> Result<PathBuf, AnyError> {\n  let icon_path = match icon {\n    crate::args::IconConfig::Single(p) => initial_cwd.join(p),\n    crate::args::IconConfig::Set(_) => {\n      deno_core::anyhow::bail!(\"icon sets are not supported in --hmr mode yet\")\n    }\n  };\n  if !icon_path.exists() {\n    deno_core::anyhow::bail!(\"icon '{}' not found\", icon_path.display());\n  }\n  match icon_path.extension().and_then(|e| e.to_str()) {\n    Some(\"icns\") | Some(\"png\") => {}\n    _ => deno_core::anyhow::bail!(\n      \"icon '{}' must be .icns or .png\",\n      icon_path.display()\n    ),\n  }\n  Ok(crate::util::fs::canonicalize_path(&icon_path).unwrap_or(icon_path))\n}\n\n/// Extract the local URL from a line of dev server output.\nfn parse_dev_server_url(line: &str) -> Option<String> {\n  let line = console_static_text::ansi::strip_ansi_codes(line);\n  // Vite prints `  ➜  Local:   http://localhost:5173/`\n  regex::Regex::new(r\"Local:\\s+(https?://\\S+)\")\n    .expect(\"regex to parse local url failed\")\n    .captures(&line)","sourceCodeStart":1151,"sourceCodeEnd":1187,"githubUrl":"https://github.com/denoland/deno/blob/f7822238cab635a3a19f99f493f675fa81a7f9d8/cli/tools/desktop.rs#L1151-L1187","documentation":"Thrown by resolve_hmr_icon_path (macOS only) when the configured single icon path, resolved by joining it with the initial working directory, does not exist on disk before the HMR app launches. The check is a plain `Path::exists`, so anything — typo, wrong cwd assumption, missing file — trips it.","triggerScenarios":"`deno desktop --hmr --icon icons/app.png` run from a directory other than the project root when the path is relative; icon file renamed or deleted after config was written; case-sensitivity mismatch on macOS filesystems after copying from Linux/Windows; absolute path pointing at an unmounted volume.","commonSituations":"Relative icon path in config but the command is launched from a subdirectory or via an IDE task with a different cwd; git checkout where .icns/.png is gitignored so teammates lack the file; path copied with a trailing space or smart quotes from docs/chat.","solutions":["Check the file exists: `ls -l <path-from-error-message>` — the error prints the joined absolute path it tried.","Run `deno desktop --hmr` from the directory the relative icon path is written against, or make the icon path absolute in the config.","Restore/regenerate the icon file (it may be gitignored or removed) and fix casing to match the filesystem exactly."],"exampleFix":"# before (run from repo root, but icon is under ./assets)\ndeno desktop --hmr --icon app-icon.icns main.ts\n\n# after\ndeno desktop --hmr --icon assets/app-icon.icns main.ts","handlingStrategy":"validation","validationCode":"# bash: check the icon resolves before launching\nICON=\"assets/AppIcon.icns\"\n[[ -f \"$ICON\" ]] || { echo \"missing icon: $ICON\" >&2; exit 1; }\ndeno desktop --hmr --icon \"$ICON\" main.ts","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer absolute icon paths in configs that run from varying cwds.","Commit icons to the repo or document the generation step; do not gitignore them silently.","Match filename casing exactly, even on case-insensitive filesystems."],"tags":["desktop","hmr","icon","file-not-found","macos"],"backgroundTag":"file-not-found","analyzedSha":"f7822238cab635a3a19f99f493f675fa81a7f9d8","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}