shadcn-ui/ui · error · Error
Unknown base color: ${options.to}. 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.
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)
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.
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
- 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.
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
- You cannot migrate to the same base color. Please choose a d
- Failed to read config at ${options.cwd}.
- Missing value for --only. Use one or more of: ${APPLY_ONLY_V
- Invalid value for --only: ${value}. Use one or more of: ${AP
- Missing preset for --only. Use: shadcn apply <preset> --only
AI-assisted analysis of shadcn-ui/ui@c06da1d0e9 (2026-08-21).
Data as JSON: /api/errors/bdc2f05646c620ee.
Report an issue: GitHub.