{"record":{"id":"4a532c9aed3dafbe","repo":"shadcn-ui/ui","slug":"invalid-value-for-only-value-use-one-or-mor","errorCode":null,"errorMessage":"Invalid value for --only: ${value}.\nUse one or more of: ${APPLY_ONLY_VALUES.join(\", \")}.\nExample: shadcn apply <preset> --only theme,font.","messagePattern":"Invalid value for --only: (.+?)\\.\nUse one or more of: (.+?)\\.\nExample: shadcn apply <preset> --only theme,font\\.","errorType":"validation","errorClass":"ApplyOnlyError","httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/commands/apply.ts","lineNumber":349,"sourceCode":"  }\n\n  return parseApplyOnlyParts(value)\n}\n\nexport function parseApplyOnlyParts(value: string) {\n  const aliases: Record<string, ApplyOnlyValue> = {\n    theme: \"theme\",\n    font: \"font\",\n    fonts: \"font\",\n  }\n  const parts = value\n    .split(\",\")\n    .map((part) => part.trim().toLowerCase())\n    .filter(Boolean)\n  const invalid = parts.filter((part) => !aliases[part])\n\n  if (!parts.length || invalid.length) {\n    throw new ApplyOnlyError(\n      [\n        `Invalid value for --only: ${value}.`,\n        `Use one or more of: ${APPLY_ONLY_VALUES.join(\", \")}.`,\n        \"Example: shadcn apply <preset> --only theme,font.\",\n      ].join(\"\\n\")\n    )\n  }\n\n  return Array.from(new Set(parts.map((part) => aliases[part])))\n}\n\nexport function validateApplyOnlyPreset(options: {\n  preset?: string\n  only?: ApplyOnlyValue[]\n}) {\n  if (!options.only || options.preset) {\n    return\n  }","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/commands/apply.ts#L331-L367","documentation":"parseApplyOnlyParts() splits the --only value on commas, lowercases and trims, and rejects anything not in {theme, font, fonts} (fonts is an alias for font). Empty token lists or any unknown token cause an ApplyOnlyError.","triggerScenarios":"`--only colors`; `--only theme,colors`; `--only ,`; `--only \"\"`; using a removed token name.","commonSituations":"Misspelling a part; passing an old or removed token; trailing commas producing empty parts.","solutions":["Use only theme and/or font (fonts is accepted as an alias).","Trim stray commas; pass e.g. --only theme,font."],"exampleFix":"# before\nshadcn apply <preset> --only colors,theme\n\n# after\nshadcn apply <preset> --only theme,font","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set([\"theme\", \"font\", \"fonts\"])\nconst parts = value.split(\",\").map((p) => p.trim().toLowerCase()).filter(Boolean)\nconst invalid = parts.filter((p) => !ALLOWED.has(p))\nif (!parts.length || invalid.length) {\n  // print guidance before calling the CLI\n}","typeGuard":"const isApplyOnlyPart = (p: string): boolean =>\n  [\"theme\", \"font\", \"fonts\"].includes(p.trim().toLowerCase())","tryCatchPattern":"try {\n  parseApplyOnlyParts(value)\n} catch (e) {\n  if (e instanceof ApplyOnlyError) {\n    // guide the user; offer the valid values\n  } else throw e\n}","preventionTips":["Whitelist tokens (theme, font, fonts) in any wrapper that constructs --only.","Document fonts as an alias for font.","Trim and reject empty parts before splitting."],"tags":["cli","validation","apply","user-input"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}