{"record":{"id":"f1d280bc14134fca","repo":"shadcn-ui/ui","slug":"unknown-flag-target-target-valid-targets","errorCode":null,"errorMessage":"Unknown ${flag} target \"${target}\". Valid targets: ${valid}.\\n\\n${USAGE}","messagePattern":"Unknown (.+?) target \"(.+?)\"\\. Valid targets: (.+?)\\.\\\\n\\\\n(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/v4/scripts/build-registry.mts","lineNumber":180,"sourceCode":"  --style <style|all>     Rebuild local generated style files under styles/<style>/ui.\n  --registry <style|all>  Rebuild installable registry JSON under public/r/styles/<style>.\n\n<style> must be \"all\" or a known final style id (e.g. base-nova, radix-nova, base-sera, new-york-v4).\nFlags can be combined, e.g. --style base-nova --registry base-nova.`\n\nfunction getKnownStyleNames() {\n  return new Set(getStylesToBuild().map((style) => style.name))\n}\n\nfunction assertKnownTarget(flag: \"--style\" | \"--registry\", target: string) {\n  if (target === \"all\") {\n    return\n  }\n\n  const knownStyleNames = getKnownStyleNames()\n  if (!knownStyleNames.has(target)) {\n    const valid = [\"all\", ...Array.from(knownStyleNames)].join(\", \")\n    throw new Error(\n      `Unknown ${flag} target \"${target}\". Valid targets: ${valid}.\\n\\n${USAGE}`\n    )\n  }\n}\n\nfunction parseBuildOptions(argv: string[]): BuildOptions {\n  let values: {\n    examples?: boolean\n    indexes?: boolean\n    style?: string\n    registry?: string\n  }\n\n  try {\n    ;({ values } = parseArgs({\n      args: argv,\n      options: {\n        examples: { type: \"boolean\" },","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/apps/v4/scripts/build-registry.mts#L162-L198","documentation":"assertKnownTarget checks the value passed to --style or --registry against the set of known final style ids (legacy styles like new-york-v4 plus generated base-style combinations like base-nova, radix-nova). Only the literal string \"all\" bypasses the check. Any other value triggers the throw, appending USAGE so the developer sees the valid id list and flag semantics.","triggerScenarios":"Passing --style nova instead of --style base-nova; passing a base name (radix, base) instead of a full style id; referencing a style id that was renamed or removed; passing a plural or typo'd flag value.","commonSituations":"After renaming/adding a style without updating muscle memory; stale docs; CI scripts that hard-code an outdated id; muscle-memory shadcn v3 names (default, new-york) used against v4 ids.","solutions":["Read the \"Valid targets\" list in the error and copy a correct id (e.g. base-nova, new-york-v4, or all).","Use --registry <id> for installable JSON or --style <id> for local generated ui files, per USAGE.","If you intended a brand-new style, register it in registry/styles + registry/config first, then target it."],"exampleFix":"# before\npnpm registry:build --style nova\n\n# after\npnpm registry:build --style base-nova","handlingStrategy":"validation","validationCode":"import { legacyStyles } from \"@/registry/_legacy-styles\"\nimport { BASES, STYLES } from \"@/registry\"\nconst known = new Set<string>([\n  ...legacyStyles.map((s) => s.name),\n  ...BASES.flatMap((b) => STYLES.map((s) => `${b.name}-${s.name}`)),\n])\nfunction assertTarget(flag: string, target: string) {\n  if (target !== \"all\" && !known.has(target)) {\n    throw new Error(`Unknown ${flag} target \"${target}\". Valid: all, ${[...known].join(\", \")}`)\n  }\n}","typeGuard":"function isKnownTarget(target: string, known: Set<string>): boolean {\n  return target === \"all\" || known.has(target)\n}","tryCatchPattern":null,"preventionTips":["Run registry:build with no args first; the script logs the style ids it processes.","Keep a README of current valid style ids and update it when styles are added/renamed.","In CI, assert the requested id against getKnownStyleNames() before invoking the build.","Use the exact id form (base-style like base-nova, or legacy like new-york-v4)."],"tags":["cli","build","validation","registry"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}