shadcn-ui/ui · error · Error

Unknown base color: . Available base colors: .

Error message

Unknown base color: ${options.to}. Available base colors: ${baseColorNames.join(", ")}.

What it means

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.

Solutions

  1. Pick the target from the list in the message: neutral, zinc, stone, mauve, olive, or taupe (lowercase).
  2. 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.
  3. For legacy names like slate use them only as --from, never --to.

Example fix

# before
npx shadcn@latest migrate base-color --to slate
# -> Unknown base color: slate. Available base colors: neutral, zinc, stone, mauve, olive, mist, taupe.

# after
npx shadcn@latest migrate base-color --from slate --to neutral
Defensive patterns

Strategy: type-guard

Validate before calling

import { BASE_COLORS } from '@/src/registry/constants' // or hardcode the list

const BASE_COLOR_NAMES = ['neutral', 'zinc', 'stone', 'mauve', 'olive', 'mist', 'taupe'] as const

function assertValidTarget(to: string): void {
  if (!BASE_COLOR_NAMES.includes(to as never)) {
    throw new Error(
      `--to must be one of: ${BASE_COLOR_NAMES.join(', ')} (got "${to}")`
    )
  }
}

Type guard

const BASE_COLOR_NAMES = ['neutral', 'zinc', 'stone', 'mauve', 'olive', 'mist', 'taupe'] as const

type BaseColorName = (typeof BASE_COLOR_NAMES)[number]

function isBaseColorName(name: string): name is BaseColorName {
  return (BASE_COLOR_NAMES as readonly string[]).includes(name)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of shadcn-ui/ui@c06da1d0e9 (2026-08-21). Data as JSON: /api/errors/bdc2f05646c620ee. Report an issue: GitHub.

Appendix: source

Thrown at packages/shadcn/src/migrations/migrate-base-color.ts:61

  if (!config.tailwind.cssVariables) {
    throw new Error(
      "The `base-color` migration requires CSS variables. Your `components.json` has `cssVariables: false`, which uses inline Tailwind color classes instead of theme variables."
    )
  }

  const baseColorChoices = BASE_COLORS.map((baseColor) => ({
    title: baseColor.label,
    value: baseColor.name,
  }))
  const baseColorNames: string[] = BASE_COLORS.map(
    (baseColor) => baseColor.name
  )

  // Only the target is validated. The source can be a legacy base color
  // (e.g. slate) an existing project still uses.
  if (options.to && !baseColorNames.includes(options.to)) {
    throw new Error(
      `Unknown base color: ${options.to}. Available base colors: ${baseColorNames.join(
        ", "
      )}.`
    )
  }

  // Default the source to the project's current base color.
  let sourceBaseColor = options.from || config.tailwind.baseColor
  let targetBaseColor = options.to

  if (!sourceBaseColor || !targetBaseColor) {
    const currentBaseColorIndex = baseColorChoices.findIndex(
      (choice) => choice.value === config.tailwind.baseColor
    )
    const migrateOptions = await prompts([
      {
        type: sourceBaseColor ? null : "select",
        name: "sourceBaseColor",

View on GitHub (pinned to c06da1d0e9)