{"record":{"id":"9e9359aba5eb4053","repo":"mermaid-js/mermaid","slug":"icon-set-not-found-data-prefix","errorCode":null,"errorMessage":"Icon set not found: ${data.prefix}","messagePattern":"Icon set not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/rendering-util/icons.ts","lineNumber":61,"sourceCode":"      throw new Error('Invalid icon loader. Must have either \"icons\" or \"loader\" property.');\n    }\n  }\n};\n\nconst getRegisteredIconData = async (iconName: string, fallbackPrefix?: string) => {\n  const data = stringToIcon(iconName, true, fallbackPrefix !== undefined);\n  if (!data) {\n    throw new Error(`Invalid icon name: ${iconName}`);\n  }\n  const prefix = data.prefix || fallbackPrefix;\n  if (!prefix) {\n    throw new Error(`Icon name must contain a prefix: ${iconName}`);\n  }\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) => {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/rendering-util/icons.ts#L43-L79","documentation":"Thrown by getRegisteredIconData when the resolved prefix is found in neither iconsStore (static packs) nor loaderStore (async packs). The prefix exists in the icon name but no registerIconPacks call ever registered a pack under that prefix key. Note the message uses data.prefix (the parsed prefix), not the fallback — if the name had no prefix, the fallback is what was tried.","triggerScenarios":"Referencing `fa:github` without ever calling registerIconPacks([{ name: 'fa', loader }]), or using a prefix that doesn't match the `name` you registered (registered 'fontawesome' but wrote 'fa:...'). Also when includeLargeFeatures/build stripped the pack import, or the registerIconPacks call hasn't run yet at lookup time.","commonSituations":"Forgetting to call registerIconPacks at app boot, calling it after the diagram renders, a typo between the registered name and the prefix used in the diagram, or using a CDN bundle that doesn't include the pack. In treeView/architecture diagrams the renderer calls registerIconPacks internally for some packs but not arbitrary ones.","solutions":["Call mermaid.registerIconPacks([{ name: '<prefix>', loader: () => import('@iconify-json/<prefix>') }]) before the diagram renders.","Make sure the `name` you register equals the prefix segment used in icon names (e.g. name: 'logos' ⇔ logos:react).","If using a CDN/fetch loader, verify the network request resolves and the JSON has the expected shape.","Confirm registerIconPacks runs in the same module/bundle instance that renders — split bundles can leave the registry empty."],"exampleFix":"// before\nmermaid.render(...) // referencing logos:react, nothing registered\n// after\nmermaid.registerIconPacks([\n  { name: 'logos', loader: () => import('@iconify-json/logos').then((m) => m.icons) },\n]);\nmermaid.render(...); // logos:react now resolves","handlingStrategy":"validation","validationCode":"const registered = new Set(['logos', 'fa']); // mirrors registerIconPacks calls\nfunction isRegisteredPrefix(p: string): boolean { return registered.has(p); }\nif (!isRegisteredPrefix(prefix)) throw new Error(`prefix '${prefix}' not registered; call registerIconPacks`);","typeGuard":"function isKnownPrefix(p: string, known: string[]): p is string { return known.includes(p); }","tryCatchPattern":"try { await getIconSVG(name); } catch (e) { if (/Icon set not found/.test(String(e))) { await ensurePackRegistered(prefix); return getIconSVG(name); } throw e; }","preventionTips":["Register all packs at app boot before any render.","Keep the registered name identical to the prefix used in diagrams.","Use one module to centralize all registerIconPacks calls."],"tags":["icons","configuration","iconify","registry"],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}