shadcn-ui/ui · error · Error
--style ${target} is not supported because it is a legacy so
Error message
--style ${target} is not supported because it is a legacy source registry. Use --registry ${target}. What it means
runTargetedStyleBuild rebuilds local generated ui files under styles/<style>/ui, which only exist for generated base-style combinations (tracked by STYLE_COMBINATIONS via getStyleCombination). Legacy source styles such as new-york-v4 keep authored source under registry/<style>/ui and have no generated tree, so --style rejects them; the installable JSON for a legacy style is built via --registry instead.
Source
Thrown at apps/v4/scripts/build-registry.mts:800
console.log("\n📦 Building registry/__index__.tsx...")
await buildRegistryIndex(getStylesToBuild())
console.log("\n🗂️ Building registry/__blocks__.json...")
await buildBlocksIndex()
console.log("\n📦 Building public/r/index.json...")
await buildIndex()
}
async function runExamplesBuild() {
console.log("📋 Building examples/__index__.tsx...")
await buildExamplesIndex()
}
async function runTargetedStyleBuild(target: "all" | string) {
if (target !== "all" && !getStyleCombination(target)) {
throw new Error(
`--style ${target} is not supported because it is a legacy source registry. Use --registry ${target}.`
)
}
// styles/<style>/ui only exists for generated base/style combinations, so we
// skip legacy source styles (e.g. new-york-v4) when targeting "all".
const targetStyles = getTargetStyles(target).filter((style) =>
getStyleCombination(style.name)
)
const targetStyleNames = new Set(targetStyles.map((style) => style.name))
if (targetStyleNames.size === 0) {
console.log(" No generated styles to build.")
return
}
console.log("💅 Building styles...")
await buildBases(Array.from(BASES), targetStyleNames)View on GitHub (pinned to efac598707)
Solutions
- Use --registry <legacy-style> to rebuild installable JSON for legacy styles.
- Use --style only for generated base-style combinations (e.g. base-nova, radix-nova).
- Run with no flags for a full build if unsure which flag applies.
Example fix
# before pnpm registry:build --style new-york-v4 # after pnpm registry:build --registry new-york-v4
Defensive patterns
Strategy: validation
Validate before calling
import { BASES, STYLES } from "@/registry"
const generatedCombos = new Set(BASES.flatMap((b) => STYLES.map((s) => `${b.name}-${s.name}`)))
function chooseFlag(target: string): "--style" | "--registry" {
return generatedCombos.has(target) ? "--style" : "--registry"
} Type guard
function isGeneratedCombination(name: string): boolean {
return BASES.some((b) => STYLES.some((s) => `${b.name}-${s.name}` === name))
} Prevention
- Use --style only for generated base-style combinations; use --registry for legacy source styles.
- Run a full build (no flags) when unsure which flag applies.
- Document the generated-vs-legacy distinction wherever CLI usage is described.
When it happens
Trigger: Running --style new-york-v4 (a legacy source style); running --style on any id returned by getStyleCombination as null; confusing the two flags' scopes.
Common situations: Developer wants to rebuild a legacy style and guesses --style; after converting an authored style into a generated combination without switching the flag.
Related errors
- Unknown ${flag} target "${target}". Valid targets: ${valid}.
- Invalid registry namespace: ${namespace}. Registry names mus
- NOT_FOUND
- Generated styles are missing or stale (${missingStyles.join(
- Invalid registry schema for ${base.name}
AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12).
Data as JSON: /api/errors/92ccd396908a2527.
Report an issue: GitHub.