{"record":{"id":"a38a6ab852589edf","repo":"shadcn-ui/ui","slug":"something-went-wrong-fetching-the-base-colors","errorCode":null,"errorMessage":"Something went wrong fetching the base colors.","messagePattern":"Something went wrong fetching the base colors\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/migrations/migrate-base-color.ts","lineNumber":141,"sourceCode":"        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,\n    targetVars,\n    tailwindVersion\n  )\n","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/shadcn-ui/ui/blob/c06da1d0e91e97b607d1359372347528bb35b090/packages/shadcn/src/migrations/migrate-base-color.ts#L123-L159","documentation":"The target palette fetch (getRegistryBaseColor(targetBaseColor)) resolved without a usable color. Unlike the source error, the target was already validated against BASE_COLORS, so this is not an input problem — the registry request for colors/<to>.json came back empty or unusable (network, proxy, or mirror issue).","triggerScenarios":"`npx shadcn@latest migrate base-color --to neutral` while the registry request for colors/neutral.json fails to return a body — offline machine, corporate proxy stripping responses, REGISTRY_URL mirror that lacks the colors assets, or a transient CDN error.","commonSituations":"CI runners behind restrictive proxies; self-hosted/private registry mirrors that only replicate component JSONs; flaky networks; REGISTRY_URL/HTTPS_PROXY environment overrides.","solutions":["Retry the command — transient registry failures usually clear immediately.","Verify reachability of the color payload directly: `curl -sSL https://ui.shadcn.com/r/colors/neutral.json` (or $REGISTRY_URL/colors/<to>.json).","Check environment overrides: if REGISTRY_URL points at a mirror, make sure it serves colors/*.json, or unset it; also check HTTPS_PROXY/HTTP_PROXY interference."],"exampleFix":"# before\nREGISTRY_URL=https://mirror.internal/r npx shadcn@latest migrate base-color --to neutral\n# -> Something went wrong fetching the base colors.\n\n# after\ncurl -sSL $REGISTRY_URL/colors/neutral.json   # verify the mirror serves it\nunset REGISTRY_URL\nnpx shadcn@latest migrate base-color --to neutral","handlingStrategy":"retry","validationCode":"// Pre-flight the target palette before migrating:\nconst REGISTRY_URL = process.env.REGISTRY_URL ?? 'https://ui.shadcn.com/r'\n\nasync function assertTargetColorFetchable(to: string): Promise<void> {\n  const res = await fetch(`${REGISTRY_URL}/colors/${to}.json`)\n  if (!res.ok) {\n    throw new Error(`Registry cannot serve colors/${to}.json (HTTP ${res.status}). Check network/REGISTRY_URL.`)\n  }\n  await res.json() // force body read; empty bodies fail here, not mid-migration\n}","typeGuard":null,"tryCatchPattern":"async function migrateWithRetry(config: Config, opts: { from?: string; to?: string }, attempts = 3) {\n  for (let i = 1; i <= attempts; i++) {\n    try {\n      return await migrateBaseColor(config, opts)\n    } catch (error) {\n      const message = error instanceof Error ? error.message : String(error)\n      if (message === 'Something went wrong fetching the base colors.' && i < attempts) {\n        await new Promise((r) => setTimeout(r, 500 * i)) // transient registry failure: back off and retry\n        continue\n      }\n      throw error\n    }\n  }\n}","preventionTips":["Confirm registry reachability before migrating: `curl -sSL https://ui.shadcn.com/r/colors/<to>.json`.","Keep REGISTRY_URL mirrors complete (they must serve colors/*.json, not only component items).","Treat this message as environmental (network/proxy), not as bad input — the target was already validated."],"tags":["shadcn","registry","network","base-color","proxy"],"backgroundTag":"registry-fetch-failed","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"}