{"record":{"id":"bdc2f05646c620ee","repo":"shadcn-ui/ui","slug":"unknown-base-color-options-to-available-base","errorCode":null,"errorMessage":"Unknown base color: ${options.to}. Available base colors: ${baseColorNames.join(\", \")}.","messagePattern":"Unknown base color: (.+?)\\. Available base colors: (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/migrations/migrate-base-color.ts","lineNumber":61,"sourceCode":"\n  if (!config.tailwind.cssVariables) {\n    throw new Error(\n      \"The `base-color` migration requires CSS variables. Your `components.json` has `cssVariables: false`, which uses inline Tailwind color classes instead of theme variables.\"\n    )\n  }\n\n  const baseColorChoices = BASE_COLORS.map((baseColor) => ({\n    title: baseColor.label,\n    value: baseColor.name,\n  }))\n  const baseColorNames: string[] = BASE_COLORS.map(\n    (baseColor) => baseColor.name\n  )\n\n  // Only the target is validated. The source can be a legacy base color\n  // (e.g. slate) an existing project still uses.\n  if (options.to && !baseColorNames.includes(options.to)) {\n    throw new Error(\n      `Unknown base color: ${options.to}. Available base colors: ${baseColorNames.join(\n        \", \"\n      )}.`\n    )\n  }\n\n  // Default the source to the project's current base color.\n  let sourceBaseColor = options.from || config.tailwind.baseColor\n  let targetBaseColor = options.to\n\n  if (!sourceBaseColor || !targetBaseColor) {\n    const currentBaseColorIndex = baseColorChoices.findIndex(\n      (choice) => choice.value === config.tailwind.baseColor\n    )\n    const migrateOptions = await prompts([\n      {\n        type: sourceBaseColor ? null : \"select\",\n        name: \"sourceBaseColor\",","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/shadcn-ui/ui/blob/c06da1d0e91e97b607d1359372347528bb35b090/packages/shadcn/src/migrations/migrate-base-color.ts#L43-L79","documentation":"Validates the migration target against the shipped BASE_COLORS list (neutral, zinc, stone, mauve, olive, mist, taupe). Deliberately only `to` is validated here: the source (`from`) may be a legacy base color such as slate that an older project still uses, but the target must be one of the currently supported names.","triggerScenarios":"Calling `npx shadcn@latest migrate base-color --to slate` (or gray/sand/any name outside the list), or passing migrateBaseColor(config, { to: ... }) with an unsupported name. Case matters: `--to Zinc` fails too.","commonSituations":"Assuming classic Tailwind palette names (slate, gray) are valid targets; upgrading from an older shadcn version whose color set differed; typos or wrong casing in scripts/CI pipelines that automate the migration.","solutions":["Pick the target from the list in the message: neutral, zinc, stone, mauve, olive, or taupe (lowercase).","If you expected a different name (e.g. slate), upgrade the CLI (`npx shadcn@latest`) — the supported set can change between versions — and check the error output, which always lists current names.","For legacy names like slate use them only as --from, never --to."],"exampleFix":"# before\nnpx shadcn@latest migrate base-color --to slate\n# -> Unknown base color: slate. Available base colors: neutral, zinc, stone, mauve, olive, mist, taupe.\n\n# after\nnpx shadcn@latest migrate base-color --from slate --to neutral","handlingStrategy":"type-guard","validationCode":"import { BASE_COLORS } from '@/src/registry/constants' // or hardcode the list\n\nconst BASE_COLOR_NAMES = ['neutral', 'zinc', 'stone', 'mauve', 'olive', 'mist', 'taupe'] as const\n\nfunction assertValidTarget(to: string): void {\n  if (!BASE_COLOR_NAMES.includes(to as never)) {\n    throw new Error(\n      `--to must be one of: ${BASE_COLOR_NAMES.join(', ')} (got \"${to}\")`\n    )\n  }\n}","typeGuard":"const BASE_COLOR_NAMES = ['neutral', 'zinc', 'stone', 'mauve', 'olive', 'mist', 'taupe'] as const\n\ntype BaseColorName = (typeof BASE_COLOR_NAMES)[number]\n\nfunction isBaseColorName(name: string): name is BaseColorName {\n  return (BASE_COLOR_NAMES as readonly string[]).includes(name)\n}","tryCatchPattern":null,"preventionTips":["Use lowercase names exactly as listed in the error message; validation is case-sensitive.","In automation scripts, derive --to from a typed constant (BaseColorName) instead of free-form strings.","Re-check the supported list after upgrading the shadcn CLI — the palette set has changed across versions."],"tags":["shadcn","cli","validation","base-color","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"c06da1d0e91e97b607d1359372347528bb35b090","analyzedAt":"2026-08-21T17:08:35.471Z","contentChangedAt":"2026-08-21T17:08:35.471Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}