{"record":{"id":"b7cc8dd03feb7ad5","repo":"shadcn-ui/ui","slug":"unknown-base-color-sourcebasecolor","errorCode":null,"errorMessage":"Unknown base color: ${sourceBaseColor}.","messagePattern":"Unknown base color: (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/migrations/migrate-base-color.ts","lineNumber":137,"sourceCode":"      initial: true,\n      message: `We will migrate ${highlighter.info(\n        relativePath\n      )} from ${highlighter.info(sourceBaseColor)} to ${highlighter.info(\n        targetBaseColor\n      )}. Continue?`,\n    })\n\n    if (!confirm) {\n      logger.info(\"Migration cancelled.\")\n      process.exit(0)\n    }\n  }\n\n  const sourceColor = await getRegistryBaseColor(sourceBaseColor)\n  const targetColor = await getRegistryBaseColor(targetBaseColor)\n\n  if (!sourceColor) {\n    throw new Error(`Unknown base color: ${sourceBaseColor}.`)\n  }\n\n  if (!targetColor) {\n    throw new Error(\"Something went wrong fetching the base colors.\")\n  }\n\n  const projectInfo = await getProjectInfo(config.resolvedPaths.cwd)\n  const tailwindVersion = projectInfo?.tailwindVersion ?? \"v4\"\n\n  const sourceVars = getBaseColorCssVars(sourceColor, tailwindVersion)\n  const targetVars = getBaseColorCssVars(targetColor, tailwindVersion)\n\n  const migrationSpinner = spinner(`Migrating base color...`)?.start()\n\n  const raw = await fs.readFile(config.resolvedPaths.tailwindCss, \"utf-8\")\n  const { cssVars, skipped } = getBaseColorMigration(\n    raw,\n    sourceVars,","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/shadcn-ui/ui/blob/c06da1d0e91e97b607d1359372347528bb35b090/packages/shadcn/src/migrations/migrate-base-color.ts#L119-L155","documentation":"migrateBaseColor fetches the source palette definition via getRegistryBaseColor(sourceBaseColor), which loads colors/<name>.json from the registry. The source is intentionally NOT validated against BASE_COLORS earlier (legacy colors like slate are allowed), so an unrecognized name surfaces here as \"Unknown base color\" when the lookup resolves without a usable color. (A hard 404 on the registry instead raises a separate registry fetch error.)","triggerScenarios":"Passing --from with a name the registry does not serve (custom typo, invented name), or having a stale/custom `tailwind.baseColor` in components.json that no colors/<name>.json exists for — especially when REGISTRY_URL points at a private mirror that omits the legacy color files.","commonSituations":"Old projects carrying legacy palette names in components.json; corporate registries/mirrors that only proxy component items but not colors/*.json; hand-edited configs; a REGISTRY_URL override left set in the environment.","solutions":["Pass an explicit, existing source: `--from neutral` (or another available name) instead of relying on the config value.","Fix components.json: set tailwind.baseColor to a supported name (neutral, zinc, stone, mauve, olive, mist, taupe) and re-run.","If REGISTRY_URL points at a private mirror, verify it actually serves colors/<name>.json (curl $REGISTRY_URL/colors/neutral.json); otherwise unset the override so the default registry is used."],"exampleFix":"// before — components.json has a stale/custom name\n\"tailwind\": { \"baseColor\": \"slate-dark\", ... }\nnpx shadcn@latest migrate base-color --to neutral\n// -> Unknown base color: slate-dark.\n\n// after\n\"tailwind\": { \"baseColor\": \"neutral\", ... }\nnpx shadcn@latest migrate base-color --to zinc","handlingStrategy":"try-catch","validationCode":"const AVAILABLE = new Set(['neutral', 'zinc', 'stone', 'mauve', 'olive', 'mist', 'taupe', /* legacy sources your registry still serves, e.g. */ 'slate', 'gray'])\n\n// Validate --from (or the config's baseColor) before running the CLI:\nfunction assertKnownSource(name: string | undefined): void {\n  if (!name || !AVAILABLE.has(name)) {\n    throw new Error(\n      `Unknown source base color \"${name}\". Fix tailwind.baseColor in components.json or pass --from.`\n    )\n  }\n}","typeGuard":"function isKnownBaseColor(name: string): boolean {\n  const available = ['neutral', 'zinc', 'stone', 'mauve', 'olive', 'mist', 'taupe', 'slate', 'gray']\n  return available.includes(name)\n}","tryCatchPattern":"try {\n  await migrateBaseColor(config, { from, to, yes: true })\n} catch (error) {\n  const message = error instanceof Error ? error.message : String(error)\n  if (message.startsWith('Unknown base color:')) {\n    // Input problem: fix --from or tailwind.baseColor in components.json, then retry.\n    const bad = message.match(/Unknown base color: (\\w+)/)?.[1]\n    throw new Error(`Fix the base color \"${bad}\" in components.json or pass --from with a valid name.`)\n  }\n  throw error // registry/network errors bubble up separately\n}","preventionTips":["Keep tailwind.baseColor in components.json set to a name your registry actually serves (check colors/<name>.json).","Pin REGISTRY_URL mirrors that replicate the full colors/*.json set, or unset the override.","In CI, pre-flight the source palette: `curl -sf $REGISTRY_URL/colors/$FROM.json > /dev/null` before invoking the migration."],"tags":["shadcn","registry","base-color","config","network"],"backgroundTag":"resource-not-found","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"}