shadcn-ui/ui · error · Error

You cannot migrate to the same base color. Please choose a d

Error message

You cannot migrate to the same base color. Please choose a different base color.

What it means

After resolving the effective source and target (from --from/--to flags, config.tailwind.baseColor, or interactive prompts), migrateBaseColor refuses to run when they are identical, because swapping a palette for itself would be a no-op write to your CSS and components.json.

Source

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

        name: "targetBaseColor",
        message: `Which base color would you like to ${highlighter.info(
          "migrate to"
        )}?`,
        choices: baseColorChoices,
      },
    ])

    sourceBaseColor = sourceBaseColor || migrateOptions.sourceBaseColor
    targetBaseColor = targetBaseColor || migrateOptions.targetBaseColor
  }

  if (!sourceBaseColor || !targetBaseColor) {
    logger.info("Migration cancelled.")
    process.exit(0)
  }

  if (sourceBaseColor === targetBaseColor) {
    throw new Error(
      "You cannot migrate to the same base color. Please choose a different base color."
    )
  }

  if (!options.yes) {
    const relativePath = `./${path.relative(
      config.resolvedPaths.cwd,
      config.resolvedPaths.tailwindCss
    )}`
    const { confirm } = await prompts({
      type: "confirm",
      name: "confirm",
      initial: true,
      message: `We will migrate ${highlighter.info(
        relativePath
      )} from ${highlighter.info(sourceBaseColor)} to ${highlighter.info(
        targetBaseColor
      )}. Continue?`,

View on GitHub (pinned to c06da1d0e9)

Solutions

  1. Choose a different target: check your current color in components.json (`tailwind.baseColor`) and pass a --to that differs from it.
  2. If your real goal is to re-apply/repair the current palette's tokens (e.g. after hand edits), migrate to a different base color and back, or fix the variables in your CSS manually.

Example fix

// before — components.json has "baseColor": "zinc"
npx shadcn@latest migrate base-color --to zinc
// -> You cannot migrate to the same base color.

// after
npx shadcn@latest migrate base-color --to neutral
Defensive patterns

Strategy: validation

Validate before calling

import { readFileSync } from 'fs'

// Before running `shadcn migrate base-color --to X`:
const current = JSON.parse(readFileSync('components.json', 'utf-8')).tailwind?.baseColor
const to = process.argv.includes('--to') ? process.argv[process.argv.indexOf('--to') + 1] : null

if (to && current && to === current) {
  console.error(`Target "${to}" equals the current baseColor. Pick a different --to.`)
  process.exit(1)
}

Prevention

When it happens

Trigger: `npx shadcn@latest migrate base-color --to zinc` when components.json already has baseColor "zinc" and no --from is given; or explicitly passing --from stone --to stone; or selecting the same color in the interactive prompt for both source and target.

Common situations: Forgetting which baseColor the project currently uses; re-running a previously completed migration; copy-pasted commands in docs/scripts where source equals the current theme.

Related errors


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