shadcn-ui/ui · error · Error
Invalid registry schema for ${base.name}
Error message
Invalid registry schema for ${base.name} What it means
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.
Source
Thrown at apps/v4/scripts/build-test-app.mts:290
)
const styleMap = createStyleMap(styleContent)
// Load registries for each base.
const results: Array<{
base: Base
registryItems: Array<{ name: string; files?: Array<{ path: string }> }>
styleMap: Record<string, string>
}> = []
for (const base of bases) {
const { registry: baseRegistry } = await import(
`../registry/bases/${base.name}/registry.ts`
)
const result = registrySchema.safeParse(baseRegistry)
if (!result.success) {
console.error(`❌ Registry validation failed for ${base.name}:`)
console.error(result.error.format())
throw new Error(`Invalid registry schema for ${base.name}`)
}
const registryItems = result.data.items.filter(
(item) => item.type !== "registry:internal"
)
results.push({ base, registryItems, styleMap })
console.log(` ✅ Loaded ${base.name} registry`)
}
return results
}
async function copyTransformedFiles(
sourceDir: string,
targetDir: string,
base: Base,
styleMap: Record<string, string>
) {
try {View on GitHub (pinned to efac598707)
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.
Example fix
// before
{ type: "registry:ui", files: ["ui/toast.tsx"] } // missing name
// after
{ name: "toast", type: "registry:ui", files: ["ui/toast.tsx"] } Defensive patterns
Strategy: validation
Validate before calling
import { registrySchema } from "shadcn/schema"
for (const base of bases) {
const { registry } = await import(`../registry/bases/${base.name}/registry.ts`)
const r = registrySchema.safeParse(registry)
if (!r.success) throw new Error(`${base.name}: ${JSON.stringify(r.error.format())}`)
} Type guard
function isValidBaseRegistry(value: unknown): boolean {
return registrySchema.safeParse(value).success
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Local schema drift; an item edited for a demo but not validated; CI test-app step failing after a registry change.
Related errors
- Invalid registry schema for ${base.name}
- Invalid registry schema for ${style.name}
- Invalid registry schema for ${styleName}
- INVALID_CONFIG
- PARSE_ERROR
AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12).
Data as JSON: /api/errors/76cbcade7ebed154.
Report an issue: GitHub.