{"record":{"id":"231631a50734ed42","repo":"shadcn-ui/ui","slug":"parse-error-231631","errorCode":"PARSE_ERROR","errorMessage":"Failed to parse registry item: ${item}","messagePattern":"Failed to parse registry item: (.+?)","errorType":"exception","errorClass":"RegistryParseError","httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/registry/resolver.ts","lineNumber":108,"sourceCode":"\n  const results = await Promise.all(\n    items.map(async (item) => {\n      const resolvedAddress = resolveItemAddress(item)\n\n      if (resolvedAddress.scheme === \"github\") {\n        return fetchGitHubRegistryItem(resolvedAddress, options)\n      }\n\n      if (isLocalFile(item)) {\n        return fetchRegistryLocal(item)\n      }\n\n      if (isUrl(item)) {\n        const [result] = await fetchRegistry([item], options)\n        try {\n          return registryItemSchema.parse(result)\n        } catch (error) {\n          throw new RegistryParseError(item, error)\n        }\n      }\n\n      if (item.startsWith(\"@\") && config?.registries) {\n        const paths = resolveRegistryItemsFromRegistries([item], config)\n        const [result] = await fetchRegistry(paths, options)\n        try {\n          return registryItemSchema.parse(result)\n        } catch (error) {\n          throw new RegistryParseError(item, error)\n        }\n      }\n\n      const path = `styles/${config?.style ?? \"new-york-v4\"}/${item}.json`\n      const [result] = await fetchRegistry([path], options)\n      try {\n        return registryItemSchema.parse(result)\n      } catch (error) {","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/registry/resolver.ts#L90-L126","documentation":"Thrown by fetchRegistryItems when a registry item fetched from a direct URL passes the HTTP fetch but fails validation against registryItemSchema. The endpoint was reachable, but the returned JSON does not conform to the shadcn registry-item schema (missing name/type, wrong type enum value, malformed files, etc.). The underlying ZodError is wrapped in a RegistryParseError so callers see a single, consistent parse-failure type.","triggerScenarios":"Calling resolveRegistryItems / the `add` flow with a URL argument like `npx shadcn add https://example.com/button.json` where the response body is JSON but does not satisfy registryItemSchema (e.g. missing `type`, unknown `type` string, files array with wrong shape).","commonSituations":"A third-party registry author shipped a payload for an older or newer schema than the consumer's shadcn version; the URL returns an error envelope (e.g. `{\"error\":\"...\"}`) with HTTP 200 instead of a registry item; a typo'd URL hits an unrelated JSON endpoint; server returns HTML that happens to parse.","solutions":["Open the URL in a browser and confirm the body has `name`, a valid `type` (one of registryItemTypeSchema's enum values, e.g. registry:ui), and a well-formed `files` array.","Diff the payload against https://ui.shadcn.com/schema/registry-item.json and add/fix the fields flagged by the Zod error in the message.","Have the registry author republish the item matching the current schema; if you control the URL, fix the JSON on the server.","If the URL is wrong, re-run `shadcn add` with the corrected URL."],"exampleFix":"// before — payload at https://example.com/button.json\n{\n  \"name\": \"button\",\n  \"files\": [{ \"path\": \"button.tsx\" }]\n}\n\n// after — type added so registryItemSchema accepts it\n{\n  \"name\": \"button\",\n  \"type\": \"registry:ui\",\n  \"files\": [{ \"path\": \"button.tsx\" }]\n}","handlingStrategy":"try-catch","validationCode":"import { registryItemSchema } from \"@/src/schema\";\n\nasync function preValidateUrl(url: string) {\n  const res = await fetch(url);\n  const json = await res.json();\n  const r = registryItemSchema.safeParse(json);\n  if (!r.success) {\n    return { ok: false, issues: r.error.issues };\n  }\n  return { ok: true, item: r.data };\n}","typeGuard":"import { registryItemSchema } from \"@/src/schema\";\n\nfunction isRegistryItem(v: unknown): v is z.infer<typeof registryItemSchema> {\n  return registryItemSchema.safeParse(v).success;\n}","tryCatchPattern":"import { RegistryParseError } from \"@/src/registry/errors\";\n\ntry {\n  await resolveRegistryItems([url], config, opts);\n} catch (e) {\n  if (e instanceof RegistryParseError) {\n    console.error(\"Item at\", e.item, \"failed schema:\", e.parseError);\n  }\n  throw e;\n}","preventionTips":["Pre-validate third-party registry URLs against https://ui.shadcn.com/schema/registry-item.json before wiring them into components.json.","Pin your shadcn version so schema expectations are stable relative to the registries you consume.","For your own registries, run `registryItemSchema.parse(payload)` in CI before publishing."],"tags":["registry","schema","zod","url","parse"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}