shadcn-ui/ui · error
Invalid base: ${String(resolvedBase)}. Expected one of: ${PR
Error message
Invalid base: ${String(resolvedBase)}. Expected one of: ${PRESET_BASES.join(", ")}. What it means
resolveDocsBase throws when the resolved base — taken from the --base flag or derived from the configured style via getBase — is not one of the preset bases radix/base/aria. The docs command needs a valid base to build the correct documentation URLs.
Source
Thrown at packages/shadcn/src/commands/docs.ts:108
)
for (const { component, links } of results) {
logger.log(highlighter.info(component))
for (const [key, value] of Object.entries(links)) {
logger.log(` - ${key.padEnd(maxKeyLength + 2)}${value}`)
}
logger.break()
}
} catch (error) {
handleError(error)
}
})
export function resolveDocsBase(base: unknown, style: string | undefined) {
const resolvedBase = base ?? getBase(style)
if (!isPresetBase(resolvedBase)) {
throw new Error(
`Invalid base: ${String(resolvedBase)}. Expected one of: ${PRESET_BASES.join(
", "
)}.`
)
}
return resolvedBase
}
function normalizeLinks(links: Record<string, string>) {
return Object.fromEntries(
Object.entries(links).map(([key, value]) => [
key,
value.startsWith(SHADCN_BASE_URL)
? `${SHADCN_URL}${value.slice(SHADCN_BASE_URL.length)}`
: value,
])
)View on GitHub (pinned to efac598707)
Solutions
- Pass --base as exactly one of: radix, base, aria.
- Fix the style in components.json so it starts with one of the preset base prefixes (radix-, base-, aria-).
- Check the PRESET_BASES list for your shadcn version in packages/shadcn/src/preset/preset.ts.
Example fix
// before shadcn docs --base tailwind // after shadcn docs --base base
Defensive patterns
Strategy: validation
Validate before calling
import { PRESET_BASES, isPresetBase } from "@/preset/preset"
function assertDocsBase(base: unknown, style?: string) {
const resolved = base ?? deriveBaseFromStyle(style)
if (!isPresetBase(resolved)) {
throw new Error(`Base must be one of: ${PRESET_BASES.join(", ")}`)
}
} Type guard
import { isPresetBase, type PresetBase } from "@/preset/preset"
function isPresetBaseValue(v: unknown): v is PresetBase {
return isPresetBase(v)
} Prevention
- Validate --base against PRESET_BASES (radix, base, aria) before calling docs.
- Keep style names prefixed with a known base.
When it happens
Trigger: Calling `shadcn docs --base <other>` where <other> is not radix/base/aria, or having a components.json style whose prefix doesn't match a known base AND no --base override is supplied.
Common situations: Typo in --base (e.g., --base=tailwind, --base=default), a custom style name that doesn't start with radix-/base-/aria-, hand-edited components.json with an unknown style, mismatched expectations across shadcn versions.
Related errors
- Unknown preset: ${presetArg}
- Unknown client: ${client}. Available clients: ${CLIENTS.map(
- Something went wrong reading your `components.json` file. Pl
- Invalid preset code: ${code}
- Unknown icon library: ${libraryName}. Available libraries: $
AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12).
Data as JSON: /api/errors/674c459c3027ab3c.
Report an issue: GitHub.