{"record":{"id":"12929de5b309e830","repo":"denoland/deno","slug":"no-valid-icon-images-found-for-icns","errorCode":null,"errorMessage":"No valid icon images found for .icns","messagePattern":"No valid icon images found for \\.icns","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/desktop.rs","lineNumber":5536,"sourceCode":"  icns_path: &Path,\n) -> Result<(), deno_core::error::AnyError> {\n  use std::io::Write;\n\n  let mut icons: Vec<(&'static [u8; 4], Vec<u8>)> = Vec::new();\n  for entry in entries {\n    let src = cwd.join(&entry.path);\n    if !src.exists() {\n      log::warn!(\"Icon '{}' not found, skipping\", src.display());\n      continue;\n    }\n    let data = std::fs::read(&src)?;\n    for code in icns_ostypes_for_size(entry.size) {\n      icons.push((*code, data.clone()));\n    }\n  }\n\n  if icons.is_empty() {\n    deno_core::anyhow::bail!(\"No valid icon images found for .icns\");\n  }\n\n  // File header (8 bytes) + for each icon: 4-byte OSType + 4-byte length + payload.\n  let total_size: u32 = icons\n    .iter()\n    .map(|(_, data)| 8 + data.len() as u32)\n    .sum::<u32>()\n    + 8;\n\n  let mut buf = Vec::with_capacity(total_size as usize);\n  buf.write_all(b\"icns\")?;\n  buf.write_all(&total_size.to_be_bytes())?;\n  for (code, data) in &icons {\n    buf.write_all(*code)?;\n    let entry_len = 8 + data.len() as u32;\n    buf.write_all(&entry_len.to_be_bytes())?;\n    buf.write_all(data)?;\n  }","sourceCodeStart":5518,"sourceCodeEnd":5554,"githubUrl":"https://github.com/denoland/deno/blob/f7822238cab635a3a19f99f493f675fa81a7f9d8/cli/tools/desktop.rs#L5518-L5554","documentation":"The .icns builder iterates configured icon entries: files that don't exist are skipped with a warning, and sizes that don't map to a standard macOS iconset slot (only 16/32/64/128/256/512/1024 are recognized by icns_ostypes_for_size) contribute no OSType and are also skipped with a warning. If no entry survives — none of the files exist, or all sizes are non-standard — the build bails.","triggerScenarios":"All icon paths in the desktop config resolve to nonexistent files (paths are joined against the project cwd, so wrong relative paths are the usual cause), or every configured size is unsupported (48, 0, 999...), so icons ends up empty even though files exist.","commonSituations":"Icons declared relative to the config file instead of the working directory; sizes like 48 or 20 picked by hand; icon files excluded from git so only CI fails.","solutions":["Fix the icon paths so each resolves relative to the cwd you run `deno desktop` from.","Use only standard iconset sizes: 16, 32, 64, 128, 256, 512, 1024.","Watch the preceding 'Icon ... not found, skipping' and \"doesn't map to a standard macOS iconset slot\" warnings — they say exactly which entries dropped out.","Make sure at least one icon file is committed/exists on the build machine."],"exampleFix":"// before: wrong relative root + non-standard size\n\"icons\": [{ \"path\": \"./assets/icons/logo_48.png\", \"size\": 48 }]\n\n// after\n\"icons\": [{ \"path\": \"assets/icons/logo_256.png\", \"size\": 256 }]","handlingStrategy":"validation","validationCode":"// Validate icon config before building (paths are cwd-relative; sizes must be iconset slots)\nconst ICONSET_SIZES = new Set([16, 32, 64, 128, 256, 512, 1024]);\nfor (const icon of config.desktop.icons) {\n  if (!ICONSET_SIZES.has(icon.size)) throw new Error(`size ${icon.size} is not a standard iconset slot`);\n  if (!existsSync(icon.path)) throw new Error(`icon not found: ${icon.path}`);\n}","typeGuard":"function isStandardIconsetSize(n: number): boolean {\n  return [16, 32, 64, 128, 256, 512, 1024].includes(n);\n}","tryCatchPattern":null,"preventionTips":["Always provide at least the 512 (or 1024) slot for macOS builds.","Resolve icon paths from the project cwd in scripts; document that they are not config-file-relative.","Commit icon assets so CI sees the same files as local builds."],"tags":["desktop","macos","icons","icns","config"],"backgroundTag":"missing-icon-resource","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"}