{"record":{"id":"a076739f2d098ced","repo":"shadcn-ui/ui","slug":"invalid-registry-schema-for-style-name","errorCode":null,"errorMessage":"Invalid registry schema for ${style.name}","messagePattern":"Invalid registry schema for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/v4/scripts/build-registry.mts","lineNumber":1250,"sourceCode":"import \"server-only\"\n\nexport const Index: Record<string, Record<string, any>> = {`\n\n  const componentShards: ComponentShard[] = []\n\n  for (const style of styles) {\n    const styleCombination = getStyleCombination(style.name)\n    const { registry: importedRegistry } = styleCombination\n      ? await import(\n          `../registry/bases/${styleCombination.base.name}/registry.ts`\n        )\n      : await import(`../registry/${style.name}/registry.ts`)\n\n    const parseResult = registrySchema.safeParse(importedRegistry)\n    if (!parseResult.success) {\n      console.error(`❌ Registry validation failed for ${style.name}:`)\n      console.error(parseResult.error.format())\n      throw new Error(`Invalid registry schema for ${style.name}`)\n    }\n\n    const registry = parseResult.data\n\n    index += `\n  \"${style.name}\": {`\n    const shard: ComponentShard = { key: style.name, entries: \"\", names: [] }\n\n    for (const item of registry.items) {\n      if (item.type === \"registry:internal\") {\n        continue\n      }\n\n      if (styleCombination && !shouldIncludeStyledRegistryItem(item)) {\n        continue\n      }\n\n      const files = normalizeRegistryFiles(item)","sourceCodeStart":1232,"sourceCodeEnd":1268,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/apps/v4/scripts/build-registry.mts#L1232-L1268","documentation":"registrySchema.safeParse guard in the per-style index build path: for each style, the script imports its registry (from the base combination for generated styles, or registry/<style>/registry.ts for legacy styles), parses it, and on failure logs the formatted Zod error and throws 'Invalid registry schema for <style>'.","triggerScenarios":"A legacy style's registry.ts violating registrySchema; a generated combination's base registry failing validation surfaced when building that style's index; wrong item shape/type/files.","commonSituations":"Editing a legacy style registry; schema tightened in shadcn/schema; new item added without a required field.","solutions":["Read the 'Registry validation failed for <style>' block above the throw for the exact Zod issue.","Fix the offending item in the style's registry.ts (or its base for generated combos).","Validate with registrySchema.parse locally before running the index build."],"exampleFix":"// before\n{ type: \"registry:ui\", files: [\"ui/card.tsx\"] } // missing name\n\n// after\n{ name: \"card\", type: \"registry:ui\", files: [\"ui/card.tsx\"] }","handlingStrategy":"validation","validationCode":"import { registrySchema } from \"shadcn/schema\"\nfor (const style of getStylesToBuild()) {\n  const { registry } = styleCombination\n    ? await import(`../registry/bases/${styleCombination.base.name}/registry.ts`)\n    : await import(`../registry/${style.name}/registry.ts`)\n  const r = registrySchema.safeParse(registry)\n  if (!r.success) throw new Error(`${style.name}: ${JSON.stringify(r.error.format())}`)\n}","typeGuard":"function isValidStyleRegistry(value: unknown): boolean {\n  return registrySchema.safeParse(value).success\n}","tryCatchPattern":null,"preventionTips":["Validate each style registry (and its base for generated combos) with registrySchema.parse.","Re-run validation after schema upgrades.","Fix legacy style registries before building the style index."],"tags":["build","registry","schema","zod","index"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}