{"record":{"id":"35e9815ca8df9796","repo":"denoland/deno","slug":"icon-sets-are-not-supported-in-hmr-mode-yet","errorCode":null,"errorMessage":"icon sets are not supported in --hmr mode yet","messagePattern":"icon sets are not supported in --hmr mode yet","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/desktop.rs","lineNumber":1165,"sourceCode":"    format!(\"{}{}\", bytes, UNITS[unit])\n  } else {\n    format!(\"{:.1}{}\", size, UNITS[unit])\n  }\n}\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);","sourceCodeStart":1147,"sourceCodeEnd":1183,"githubUrl":"https://github.com/denoland/deno/blob/f7822238cab635a3a19f99f493f675fa81a7f9d8/cli/tools/desktop.rs#L1147-L1183","documentation":"Thrown by resolve_hmr_icon_path (macOS only) when `deno desktop --hmr` is asked to show an app icon that was configured as an icon SET — a size-to-path mapping (IconConfig::Set) — rather than a single .icns/.png file. The HMR dev loop passes one icon path to the LAUFEY backend via LAUFEY_APP_ICON (`-[NSImage initWithContentsOfFile:]`), which has no concept of a size set, so sets are not supported in HMR mode yet.","triggerScenarios":"Running `deno desktop --hmr` on macOS while the config file defines `icon` as an object mapping sizes to files (DesktopIconValue::Set → IconConfig::Set), e.g. `\"icon\": { \"16\": \"icons/16.png\", \"32\": \"icons/32.png\" }`.","commonSituations":"A project configured for production bundling with a full icon set (multiple resolutions), then starting dev mode with --hmr on the same config; migrating a config from a template that ships icon sets; CI running --hmr smoke tests against the shipping config.","solutions":["Point the config at a single .icns (preferred on macOS, contains all sizes) or .png for the duration of HMR development.","Or override on the CLI with a single icon: `deno desktop --hmr --icon assets/AppIcon.icns main.ts`.","Or drop the icon configuration for dev runs — HMR works without an icon."],"exampleFix":"// deno.json (or deno.jsonc) — before\n{\n  \"desktop\": {\n    \"icon\": { \"16\": \"icons/16.png\", \"32\": \"icons/32.png\", \"512\": \"icons/512.png\" }\n  }\n}\n\n// after\n{\n  \"desktop\": {\n    \"icon\": \"icons/AppIcon.icns\"\n  }\n}","handlingStrategy":"validation","validationCode":"# bash: fail early if hmr is combined with an icon set\nif deno json 2>/dev/null | jq -e '.desktop.icon | type == \"object\"' >/dev/null 2>&1 && [[ \"$1\" == *--hmr* ]]; then\n  echo \"icon sets are unsupported with --hmr; use a single .icns/.png\" >&2; exit 1\nfi\ndeno desktop --hmr main.ts","typeGuard":"// TypeScript (config check before dev runs)\nfunction isIconSet(cfg: { desktop?: { icon?: unknown } }): boolean {\n  return typeof cfg.desktop?.icon === \"object\" && cfg.desktop?.icon !== null;\n}\n// if (wantsHmr && isIconSet(config)) -> switch config to a single icon string","tryCatchPattern":null,"preventionTips":["Keep a dev-flavored config with a single .icns icon and use the icon-set config only for release builds.","Prefer one multi-resolution .icns on macOS — it satisfies both modes.","Wire CI to run a `deno desktop --hmr` smoke test so this combination cannot regress unnoticed."],"tags":["desktop","hmr","icon","macos","unsupported-feature"],"backgroundTag":"unsupported-feature-combination","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"}