{"record":{"id":"d38ae057fc0749a4","repo":"shadcn-ui/ui","slug":"invalid-registry-schema-for-stylename","errorCode":null,"errorMessage":"Invalid registry schema for ${styleName}","messagePattern":"Invalid registry schema for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/v4/scripts/build-registry.mts","lineNumber":1348,"sourceCode":"    await formatGeneratedSource(index, outputPath)\n  )\n\n  await writeComponentShards(\n    path.join(process.cwd(), \"registry/__components__\"),\n    componentShards\n  )\n}\n\nasync function buildRegistryJsonFile(styleName: string) {\n  const { registry: importedRegistry } = await import(\n    `../registry/${styleName}/registry.ts`\n  )\n\n  const parseResult = registrySchema.safeParse(importedRegistry)\n  if (!parseResult.success) {\n    console.error(`❌ Registry validation failed for ${styleName}:`)\n    console.error(parseResult.error.format())\n    throw new Error(`Invalid registry schema for ${styleName}`)\n  }\n\n  const registry = parseResult.data\n\n  // Legacy source styles (e.g. new-york-v4) don't author font items. Inject\n  // the shared registry fonts so the shadcn CLI emits font-*.json for them,\n  // matching the generated base/style combinations (which spread the same\n  // fonts in their base registries). Font items have no files, so they pass\n  // through every transform stage untouched.\n  const registryItems = getStyleCombination(styleName)\n    ? registry.items\n    : [\n        ...registry.items,\n        ...fonts.filter(\n          (font) => !registry.items.some((item) => item.name === font.name)\n        ),\n      ]\n","sourceCodeStart":1330,"sourceCodeEnd":1366,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/apps/v4/scripts/build-registry.mts#L1330-L1366","documentation":"registrySchema.safeParse guard inside buildRegistryJsonFile, which produces the installable public/r/styles/<style> JSON via the shadcn CLI. The style registry is imported from registry/<styleName>/registry.ts, parsed, and on failure the formatted Zod error is logged and 'Invalid registry schema for <styleName>' is thrown.","triggerScenarios":"Running --registry <style> (or full build) when that style's registry.ts fails schema validation; legacy font injection logic expecting fields the registry no longer has.","commonSituations":"Authoring a new style registry with an invalid item; schema upgrade; CI registry export exposing a previously skipped style.","solutions":["Inspect the 'Registry validation failed for <styleName>' log for the precise field/path.","Correct the item in registry/<styleName>/registry.ts.","Run registrySchema.parse on the file in isolation to iterate."],"exampleFix":"// before\n{ type: \"registry:ui\", files: [\"ui/dialog.tsx\"] } // missing name\n\n// after\n{ name: \"dialog\", type: \"registry:ui\", files: [\"ui/dialog.tsx\"] }","handlingStrategy":"validation","validationCode":"import { registrySchema } from \"shadcn/schema\"\nconst { registry } = await import(`../registry/${styleName}/registry.ts`)\nconst r = registrySchema.safeParse(registry)\nif (!r.success) throw new Error(`${styleName}: ${JSON.stringify(r.error.format())}`)","typeGuard":"function isValidRegistry(value: unknown): boolean {\n  return registrySchema.safeParse(value).success\n}","tryCatchPattern":null,"preventionTips":["Run registrySchema.parse on each style registry before exporting via --registry.","Keep font-injection expectations aligned with current schema fields.","Add a CI gate that exports every style only after parsing its registry."],"tags":["build","registry","schema","zod","cli-export"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}