{"record":{"id":"7a939547d822c088","repo":"shadcn-ui/ui","slug":"missing-value-for-only-use-one-or-more-of-ap","errorCode":null,"errorMessage":"Missing value for --only.\nUse one or more of: ${APPLY_ONLY_VALUES.join(\", \")}.\nExample: shadcn apply <preset> --only theme,font.","messagePattern":"Missing 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":324,"sourceCode":"  }\n\n  const url = new URL(preset)\n  if (url.pathname !== \"/init\") {\n    return undefined\n  }\n\n  return url.searchParams.get(\"only\") ?? undefined\n}\n\nexport function resolveApplyOnly(\n  value: z.infer<typeof applyOptionsSchema>[\"only\"]\n) {\n  if (value === undefined || value === false) {\n    return undefined\n  }\n\n  if (value === true) {\n    throw new ApplyOnlyError(\n      [\n        \"Missing value for --only.\",\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 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","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/commands/apply.ts#L306-L342","documentation":"resolveApplyOnly() throws ApplyOnlyError when the --only flag is present as a bare boolean (true) with no value. `shadcn apply` requires --only to take one or more of the allowed values (theme, font), so a bare flag is treated as a usage error.","triggerScenarios":"Running `shadcn apply <preset> --only` with nothing after the flag; a CLI wrapper passing only: true; misusing --only as a boolean toggle.","commonSituations":"Typing the flag without a value; misunderstanding --only as an on/off switch.","solutions":["Provide a value, e.g. --only theme or --only theme,font.","If you meant to apply everything, omit --only entirely."],"exampleFix":"# before\nshadcn apply <preset> --only\n\n# after\nshadcn apply <preset> --only theme,font","handlingStrategy":"validation","validationCode":"if (options.only === true) {\n  console.error(\"Missing value for --only. Use: shadcn apply <preset> --only theme,font\")\n  process.exit(1)\n}","typeGuard":"const hasOnlyValue = (only: unknown): only is string =>\n  typeof only === \"string\" && only.trim() !== \"\"","tryCatchPattern":"try {\n  resolveApplyOnly(options.only)\n} catch (e) {\n  if (e instanceof ApplyOnlyError) {\n    // print guidance and exit 1\n  } else throw e\n}","preventionTips":["Document --only as requiring a value (not a boolean toggle).","Validate flags in any wrapper before dispatching to resolveApplyOnly."],"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"}