shadcn-ui/ui · error · ApplyOnlyError
Missing preset for --only. Use: shadcn apply <preset> --only
Error message
Missing preset for --only. Use: shadcn apply <preset> --only theme,font.
What it means
validateApplyOnlyPreset() throws ApplyOnlyError when --only is set but no preset was supplied (positionally or via --preset). Applying a partial preset (only theme and/or font) still requires knowing which preset to read those parts from.
Source
Thrown at packages/shadcn/src/commands/apply.ts:369
`Invalid value for --only: ${value}.`,
`Use one or more of: ${APPLY_ONLY_VALUES.join(", ")}.`,
"Example: shadcn apply <preset> --only theme,font.",
].join("\n")
)
}
return Array.from(new Set(parts.map((part) => aliases[part])))
}
export function validateApplyOnlyPreset(options: {
preset?: string
only?: ApplyOnlyValue[]
}) {
if (!options.only || options.preset) {
return
}
throw new ApplyOnlyError(
[
"Missing preset for --only.",
"Use: shadcn apply <preset> --only theme,font.",
].join("\n")
)
}
function resolveApplyRegistryBaseConfig(options: {
registryBaseConfig: Record<string, unknown> | undefined
existingConfig: Record<string, unknown>
only: ApplyOnlyValue[] | undefined
}) {
if (!options.only || options.only.includes("theme")) {
return options.registryBaseConfig
}
const existingTailwind =
typeof options.existingConfig.tailwind === "object" &&View on GitHub (pinned to efac598707)
Solutions
- Provide a preset: `shadcn apply <preset> --only theme`.
- Drop --only if you want the full default flow.
Example fix
# before shadcn apply --only theme # after shadcn apply <preset> --only theme
Defensive patterns
Strategy: validation
Validate before calling
if (options.only && !options.preset) {
console.error("Missing preset for --only. Use: shadcn apply <preset> --only theme,font")
process.exit(1)
} Type guard
const hasPresetForOnly = (o: { only?: unknown; preset?: string }): boolean =>
!o.only || Boolean(o.preset) Try / catch
try {
validateApplyOnlyPreset(options)
} catch (e) {
if (e instanceof ApplyOnlyError) {
// prompt for a preset
} else throw e
} Prevention
- Require a preset whenever --only is used.
- Validate the preset/only pairing before running apply.
When it happens
Trigger: `shadcn apply --only theme` with no preset argument; setting only without a preset in a wrapper; assuming --only infers a default preset.
Common situations: Forgetting the preset positional; assuming a default preset applies.
Related errors
- Missing value for --only. Use one or more of: ${APPLY_ONLY_V
- Invalid value for --only: ${value}. Use one or more of: ${AP
- Unknown client: ${client}. Available clients: ${CLIENTS.map(
- Invalid registry namespace: ${namespace}. Registry names mus
- Unknown icon library: ${libraryName}. Available libraries: $
AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12).
Data as JSON: /api/errors/7eca2cb77dd358f0.
Report an issue: GitHub.