shadcn-ui/ui · error · RegistryItemNotFoundError

NOT_FOUND

NOT_FOUND

Error message

Registry item "${itemName}" was not found.

What it means

Thrown by loadRegistryItemFromSource after the source registry (root + all includes) has been fully read and the requested itemName does not match any item.name in the resolved catalog. This is the source/build-mode lookup path backed by a RegistrySourceReader, not the network shadcn registry. The error is a RegistryItemNotFoundError with code NOT_FOUND and a 404-equivalent status.

Source

Thrown at packages/shadcn/src/registry/source.ts:53

export async function loadRegistryItemFromSource(
  itemName: string,
  reader: RegistrySourceReader,
  options: {
    registryFile?: string
    source?: string
  } = {}
) {
  const registryFile = normalizeSourcePath(
    options.registryFile ?? "registry.json"
  )
  const result = await readSourceRegistryWithIncludes(registryFile, reader, {
    source: options.source,
  })
  const item = result.registry.items.find((item) => item.name === itemName)

  if (!item) {
    throw new RegistryItemNotFoundError(itemName)
  }

  return createRegistryItemFromSource(item, result, reader)
}

export async function loadRegistryCatalogFromSource(
  reader: RegistrySourceReader,
  options: {
    registryFile?: string
    source?: string
  } = {}
) {
  const registryFile = normalizeSourcePath(
    options.registryFile ?? "registry.json"
  )
  const result = await readSourceRegistryWithIncludes(registryFile, reader, {
    source: options.source,
  })

View on GitHub (pinned to efac598707)

Solutions

  1. Call loadRegistryCatalogFromSource with the same reader/options and list the available item names to verify spelling.
  2. Ensure the registry.json that declares the item is reachable (root or listed in an include chain).
  3. Check item name casing and exact spelling against the `name` field in the source JSON.
Defensive patterns

Strategy: validation

Validate before calling

const catalog = await loadRegistryCatalogFromSource(reader, { registryFile });
const known = new Set(catalog.items.map((i) => i.name));
if (!known.has(itemName)) {
  // don't call loadRegistryItemFromSource; surface available names to the user
}

Type guard

function isKnownItem(itemName: string, names: string[]): boolean {
  return names.includes(itemName);
}

Try / catch

import { RegistryItemNotFoundError } from "@/src/registry/errors";

try {
  await loadRegistryItemFromSource(itemName, reader, opts);
} catch (e) {
  if (e instanceof RegistryItemNotFoundError) {
    // e.itemName is what was requested; suggest calling loadRegistryCatalogFromSource
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling `loadRegistryItemFromSource('foo', reader, { registryFile: 'registry.json' })` when no item with name `foo` is declared in the root registry.json or any of its includes.

Common situations: Typo in the requested item name; the item lives in a registry.json that wasn't included; the item was renamed or removed in a recent registry edit; case mismatch in the name.

Related errors


AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12). Data as JSON: /api/errors/d265db190a969516. Report an issue: GitHub.