{"record":{"id":"7edafdf10b41d64f","repo":"shadcn-ui/ui","slug":"you-cannot-migrate-to-the-same-base-color-please","errorCode":null,"errorMessage":"You cannot migrate to the same base color. Please choose a different base color.","messagePattern":"You cannot migrate to the same base color\\. Please choose a different base color\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/migrations/migrate-base-color.ts","lineNumber":106,"sourceCode":"        name: \"targetBaseColor\",\n        message: `Which base color would you like to ${highlighter.info(\n          \"migrate to\"\n        )}?`,\n        choices: baseColorChoices,\n      },\n    ])\n\n    sourceBaseColor = sourceBaseColor || migrateOptions.sourceBaseColor\n    targetBaseColor = targetBaseColor || migrateOptions.targetBaseColor\n  }\n\n  if (!sourceBaseColor || !targetBaseColor) {\n    logger.info(\"Migration cancelled.\")\n    process.exit(0)\n  }\n\n  if (sourceBaseColor === targetBaseColor) {\n    throw new Error(\n      \"You cannot migrate to the same base color. Please choose a different base color.\"\n    )\n  }\n\n  if (!options.yes) {\n    const relativePath = `./${path.relative(\n      config.resolvedPaths.cwd,\n      config.resolvedPaths.tailwindCss\n    )}`\n    const { confirm } = await prompts({\n      type: \"confirm\",\n      name: \"confirm\",\n      initial: true,\n      message: `We will migrate ${highlighter.info(\n        relativePath\n      )} from ${highlighter.info(sourceBaseColor)} to ${highlighter.info(\n        targetBaseColor\n      )}. Continue?`,","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/shadcn-ui/ui/blob/c06da1d0e91e97b607d1359372347528bb35b090/packages/shadcn/src/migrations/migrate-base-color.ts#L88-L124","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Choose a different target: check your current color in components.json (`tailwind.baseColor`) and pass a --to that differs from it.","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."],"exampleFix":"// before — components.json has \"baseColor\": \"zinc\"\nnpx shadcn@latest migrate base-color --to zinc\n// -> You cannot migrate to the same base color.\n\n// after\nnpx shadcn@latest migrate base-color --to neutral","handlingStrategy":"validation","validationCode":"import { readFileSync } from 'fs'\n\n// Before running `shadcn migrate base-color --to X`:\nconst current = JSON.parse(readFileSync('components.json', 'utf-8')).tailwind?.baseColor\nconst to = process.argv.includes('--to') ? process.argv[process.argv.indexOf('--to') + 1] : null\n\nif (to && current && to === current) {\n  console.error(`Target \"${to}\" equals the current baseColor. Pick a different --to.`)\n  process.exit(1)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check tailwind.baseColor in components.json before choosing --to.","When scripting the migration, read the current baseColor programmatically and assert it differs from the target.","Remember the source defaults to the config's baseColor when --from is omitted."],"tags":["shadcn","validation","base-color","migration"],"backgroundTag":"invalid-argument-combination","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"}