{"record":{"id":"09584d9f14df35c5","repo":"mermaid-js/mermaid","slug":"icon-not-found-iconname","errorCode":null,"errorMessage":"Icon not found: ${iconName}","messagePattern":"Icon not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/rendering-util/icons.ts","lineNumber":74,"sourceCode":"  }\n  let icons = iconsStore.get(prefix);\n  if (!icons) {\n    const loader = loaderStore.get(prefix);\n    if (!loader) {\n      throw new Error(`Icon set not found: ${data.prefix}`);\n    }\n    try {\n      const loaded = await loader();\n      icons = { ...loaded, prefix };\n      iconsStore.set(prefix, icons);\n    } catch (e) {\n      log.error(e);\n      throw new Error(`Failed to load icon set: ${data.prefix}`);\n    }\n  }\n  const iconData = getIconData(icons, data.name);\n  if (!iconData) {\n    throw new Error(`Icon not found: ${iconName}`);\n  }\n  return iconData;\n};\n\nexport const isIconAvailable = async (iconName: string) => {\n  try {\n    await getRegisteredIconData(iconName);\n    return true;\n  } catch {\n    return false;\n  }\n};\n\nexport const getIconSVG = async (\n  iconName: string,\n  customisations?: IconifyIconCustomisations & { fallbackPrefix?: string },\n  extraAttributes?: Record<string, string>\n) => {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/rendering-util/icons.ts#L56-L92","documentation":"Thrown by getRegisteredIconData after the pack (prefix) was successfully located/loaded, but getIconData(icons, data.name) from @iconify/utils returned null — i.e. the iconify pack doesn't contain an icon with that exact name. The pack is fine; the specific icon identifier within it is wrong or missing.","triggerScenarios":"Writing `logos:reactt` (typo) against a registered logos pack, referencing a legacy/renamed icon (e.g. the pack renamed `github` → `github-icon`), or asking for an icon from the wrong pack (e.g. `logos:home` when `home` lives in a different pack). Aliases and suffixes (:-fill, :-16) that don't exist in the pack also trigger this.","commonSituations":"Icon packs version changes that rename or remove glyphs, copying an icon name from icones.js.org but registering a different/older pack version, or assuming an icon exists without checking. In flowcharts/treeView, an icon: directive with a wrong name renders (getIconSVG falls back to unknownIcon) but isIconAvailable returns false because of this throw.","solutions":["Look up the exact icon name in the registered pack's JSON or on icones.js.org for that specific pack version.","Watch for suffixes: some icons need `-fill`, `-line`, or a size like `-16`; match the variant that exists.","Register the correct pack that actually contains the icon, or switch the name to one the current pack provides.","Use isIconAvailable(name) before rendering to surface missing icons gracefully and avoid the throw."],"exampleFix":"// before\ngetIconSVG('logos:reactt'); // typo\n// after\ngetIconSVG('logos:react');","handlingStrategy":"validation","validationCode":"const ok = await mermaidAPI.isIconAvailable?.(name) ?? (await isIconAvailable(name));\nif (!ok) throw new Error(`icon '${name}' not in its pack; check spelling/version`);","typeGuard":"function iconExistsInPack(pack: any, iconName: string): boolean { return Boolean(pack?.icons?.[iconName] ?? pack?.aliases?.[iconName]); }","tryCatchPattern":"try { await getIconSVG(name); } catch (e) { if (/Icon not found/.test(String(e))) { return getIconSVG(`${prefix}:${altName}`); } throw e; }","preventionTips":["Cross-check icon names against the exact pack version on icones.js.org.","Use isIconAvailable() before render to fail soft.","Pin icon-pack versions to avoid rename/remove breakage."],"tags":["icons","iconify","validation","rendering"],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}