{"record":{"id":"7540e560de6aa751","repo":"shadcn-ui/ui","slug":"not-found-7540e5","errorCode":"NOT_FOUND","errorMessage":"Registry item \"${itemName}\" was not found.","messagePattern":"Registry item \"(.+?)\" was not found\\.","errorType":"exception","errorClass":"RegistryItemNotFoundError","httpStatus":404,"severity":"error","filePath":"packages/shadcn/src/registry/loader.ts","lineNumber":57,"sourceCode":"\nexport async function loadRegistry(options?: LoadRegistryOptions) {\n  const { cwd, registryFile } = resolveLoadRegistryOptions(options)\n  const result = await readRegistryWithIncludes(registryFile, { cwd })\n  const rootDir = getRegistryRootDir(result, cwd, registryFile)\n\n  return createRegistryCatalog(result, rootDir, cwd)\n}\n\nexport async function loadRegistryItem(\n  itemName: string,\n  options?: LoadRegistryOptions\n) {\n  const { cwd, registryFile } = resolveLoadRegistryOptions(options)\n  const result = await readRegistryWithIncludes(registryFile, { cwd })\n  const item = result.registry.items.find((item) => item.name === itemName)\n\n  if (!item) {\n    throw new RegistryItemNotFoundError(itemName)\n  }\n\n  const rootDir = getRegistryRootDir(result, cwd, registryFile)\n\n  return createRegistryItem(item, result, rootDir, cwd)\n}\n\nexport async function readRegistryWithIncludes(\n  registryFile: string,\n  options: {\n    cwd: string\n  }\n) {\n  const rootFile = path.resolve(options.cwd, registryFile)\n  const content = await readRegistryJson(rootFile)\n  const rootRegistry = parseRegistry(content, rootFile)\n  validateRootRegistry(rootRegistry, rootFile)\n  const context = {","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/registry/loader.ts#L39-L75","documentation":"Thrown by loadRegistryItem when the registry was loaded and its includes resolved, but no item in result.registry.items has a name equal to the requested itemName. RegistryItemNotFoundError is a clean 404-class error distinct from the file/parse errors that can occur earlier in loadRegistryItem.","triggerScenarios":"Calling loadRegistryItem(\"button\", ...) against a registry.json whose items[] has no item named \"button\", or where the item lives in an include that was not wired into the root registry.","commonSituations":"Typo in the item name, item renamed, item declared in a separate registry file never added to 'include', or calling loadRegistryItem on a catalog whose items are gated behind includes that failed silently upstream.","solutions":["Print the loaded catalog's item names to confirm what is actually available.","Fix the item name to match an existing 'name' in items[].","If the item is in a separate registry.json, ensure that file is listed under 'include' in the root.","Re-run loadRegistry (full catalog) and inspect the resolved items list."],"exampleFix":"// before\nloadRegistryItem(\"buton\", { cwd: projectRoot })\n\n// after (name matches items[].name)\nloadRegistryItem(\"button\", { cwd: projectRoot })","handlingStrategy":"validation","validationCode":"import { loadRegistry } from \"@/src/registry/loader\";\n\nasync function assertItemInRegistry(itemName: string, options?: LoadRegistryOptions) {\n  const catalog = await loadRegistry(options);\n  if (!catalog.items.some(i => i.name === itemName)) {\n    throw new Error(`Item \"${itemName}\" not in registry. Available: ${catalog.items.map(i => i.name).join(\", \")}`);\n  }\n}","typeGuard":"function itemInCatalog(catalog: { items: { name: string }[] }, name: string): boolean {\n  return catalog.items.some(i => i.name === name);\n}","tryCatchPattern":"try {\n  await loadRegistryItem(itemName, options);\n} catch (err) {\n  if (err instanceof RegistryItemNotFoundError) {\n    // load the full catalog and suggest the closest matching item name\n  }\n  throw err;\n}","preventionTips":["Derive item names from a loadRegistry() call rather than hardcoding strings.","Ensure items declared in separate registry.json files are referenced via 'include'.","Add a CI check that every referenced item name exists in the resolved catalog."],"tags":["registry","not-found","registry-item","loader","typescript"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}