{"record":{"id":"76cbcade7ebed154","repo":"shadcn-ui/ui","slug":"invalid-registry-schema-for-base-name-76cbca","errorCode":null,"errorMessage":"Invalid registry schema for ${base.name}","messagePattern":"Invalid registry schema for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/v4/scripts/build-test-app.mts","lineNumber":290,"sourceCode":"  )\n  const styleMap = createStyleMap(styleContent)\n\n  // Load registries for each base.\n  const results: Array<{\n    base: Base\n    registryItems: Array<{ name: string; files?: Array<{ path: string }> }>\n    styleMap: Record<string, string>\n  }> = []\n\n  for (const base of bases) {\n    const { registry: baseRegistry } = await import(\n      `../registry/bases/${base.name}/registry.ts`\n    )\n    const result = registrySchema.safeParse(baseRegistry)\n    if (!result.success) {\n      console.error(`❌ Registry validation failed for ${base.name}:`)\n      console.error(result.error.format())\n      throw new Error(`Invalid registry schema for ${base.name}`)\n    }\n    const registryItems = result.data.items.filter(\n      (item) => item.type !== \"registry:internal\"\n    )\n    results.push({ base, registryItems, styleMap })\n    console.log(`   ✅ Loaded ${base.name} registry`)\n  }\n\n  return results\n}\n\nasync function copyTransformedFiles(\n  sourceDir: string,\n  targetDir: string,\n  base: Base,\n  styleMap: Record<string, string>\n) {\n  try {","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/apps/v4/scripts/build-test-app.mts#L272-L308","documentation":"Mirror of the build-registry schema guard, but in apps/v4/scripts/build-test-app.mts: while scaffolding a test app, it imports each base's registry.ts, runs registrySchema.safeParse, and on failure logs the formatted Zod error and throws 'Invalid registry schema for <base>'. This blocks test-app generation so an invalid registry cannot ship a broken fixture.","triggerScenarios":"Running the test-app generator when a base registry.ts fails schema validation; adding an invalid item that other build paths tolerated but the test-app loader rejects.","commonSituations":"Local schema drift; an item edited for a demo but not validated; CI test-app step failing after a registry change.","solutions":["Inspect the 'Registry validation failed for <base>' log above the throw.","Fix the failing item in registry/bases/<base>/registry.ts.","Run registrySchema.parse on the base registry before invoking build-test-app."],"exampleFix":"// before\n{ type: \"registry:ui\", files: [\"ui/toast.tsx\"] } // missing name\n\n// after\n{ name: \"toast\", type: \"registry:ui\", files: [\"ui/toast.tsx\"] }","handlingStrategy":"validation","validationCode":"import { registrySchema } from \"shadcn/schema\"\nfor (const base of bases) {\n  const { registry } = await import(`../registry/bases/${base.name}/registry.ts`)\n  const r = registrySchema.safeParse(registry)\n  if (!r.success) throw new Error(`${base.name}: ${JSON.stringify(r.error.format())}`)\n}","typeGuard":"function isValidBaseRegistry(value: unknown): boolean {\n  return registrySchema.safeParse(value).success\n}","tryCatchPattern":null,"preventionTips":["Run registrySchema.parse on base registries before invoking build-test-app.","Keep the test-app step gated on the same CI schema check as build-registry.","Fix invalid items revealed by the printed Zod error path."],"tags":["build","registry","schema","zod","test-app"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}