shadcn-ui/ui · error · Error
Something went wrong fetching the base colors.
Error message
Something went wrong fetching the base colors.
What it means
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).
Source
Thrown at packages/shadcn/src/migrations/migrate-base-color.ts:141
targetBaseColor
)}. Continue?`,
})
if (!confirm) {
logger.info("Migration cancelled.")
process.exit(0)
}
}
const sourceColor = await getRegistryBaseColor(sourceBaseColor)
const targetColor = await getRegistryBaseColor(targetBaseColor)
if (!sourceColor) {
throw new Error(`Unknown base color: ${sourceBaseColor}.`)
}
if (!targetColor) {
throw new Error("Something went wrong fetching the base colors.")
}
const projectInfo = await getProjectInfo(config.resolvedPaths.cwd)
const tailwindVersion = projectInfo?.tailwindVersion ?? "v4"
const sourceVars = getBaseColorCssVars(sourceColor, tailwindVersion)
const targetVars = getBaseColorCssVars(targetColor, tailwindVersion)
const migrationSpinner = spinner(`Migrating base color...`)?.start()
const raw = await fs.readFile(config.resolvedPaths.tailwindCss, "utf-8")
const { cssVars, skipped } = getBaseColorMigration(
raw,
sourceVars,
targetVars,
tailwindVersion
)
View on GitHub (pinned to c06da1d0e9)
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.
Example fix
# before REGISTRY_URL=https://mirror.internal/r npx shadcn@latest migrate base-color --to neutral # -> Something went wrong fetching the base colors. # after curl -sSL $REGISTRY_URL/colors/neutral.json # verify the mirror serves it unset REGISTRY_URL npx shadcn@latest migrate base-color --to neutral
Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight the target palette before migrating:
const REGISTRY_URL = process.env.REGISTRY_URL ?? 'https://ui.shadcn.com/r'
async function assertTargetColorFetchable(to: string): Promise<void> {
const res = await fetch(`${REGISTRY_URL}/colors/${to}.json`)
if (!res.ok) {
throw new Error(`Registry cannot serve colors/${to}.json (HTTP ${res.status}). Check network/REGISTRY_URL.`)
}
await res.json() // force body read; empty bodies fail here, not mid-migration
} Try / catch
async function migrateWithRetry(config: Config, opts: { from?: string; to?: string }, attempts = 3) {
for (let i = 1; i <= attempts; i++) {
try {
return await migrateBaseColor(config, opts)
} catch (error) {
const message = error instanceof Error ? error.message : String(error)
if (message === 'Something went wrong fetching the base colors.' && i < attempts) {
await new Promise((r) => setTimeout(r, 500 * i)) // transient registry failure: back off and retry
continue
}
throw error
}
}
} Prevention
- 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.
When it happens
Trigger: `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.
Common situations: CI runners behind restrictive proxies; self-hosted/private registry mirrors that only replicate component JSONs; flaky networks; REGISTRY_URL/HTTPS_PROXY environment overrides.
Related errors
- Unknown base color: ${sourceBaseColor}.
- Something went wrong fetching the registry icons.
- Failed to fetch components from registry.
- UNAUTHORIZED
- NOT_FOUND
AI-assisted analysis of shadcn-ui/ui@c06da1d0e9 (2026-08-21).
Data as JSON: /api/errors/a38a6ab852589edf.
Report an issue: GitHub.