{"record":{"id":"ada48bfbb8c529a1","repo":"JuliusBrussee/caveman","slug":"provider-requires-a-value","errorCode":null,"errorMessage":"--provider requires a value","messagePattern":"--provider requires a value","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/create-caveman-agent/src/index.ts","lineNumber":67,"sourceCode":"    \"npm run dev\",\n    \"eval starts unapproved; inspect it, set approved: true, then npm run build\",\n    \"\",\n  ].join(\"\\n\"));\n}\n\nfunction parseArgs(args: string[]): {\n  target: string;\n  provider?: string;\n  install: boolean;\n} {\n  let provider: string | undefined;\n  let install = true;\n  const positional: string[] = [];\n  for (let index = 0; index < args.length; index++) {\n    const value = args[index]!;\n    if (value === \"--provider\") {\n      const candidate = args[++index];\n      if (!candidate || candidate.startsWith(\"--\")) throw new Error(\"--provider requires a value\");\n      provider = candidate;\n      continue;\n    }\n    if (value === \"--no-install\") {\n      install = false;\n      continue;\n    }\n    if (value.startsWith(\"--\")) throw new Error(`unknown option ${value}`);\n    positional.push(value);\n  }\n  if (positional.length !== 1) {\n    throw new Error(\n      USAGE,\n    );\n  }\n  return {\n    target: positional[0]!,\n    ...(provider === undefined ? {} : { provider }),","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/create-caveman-agent/src/index.ts#L49-L85","documentation":"The create-caveman-agent initializer (`npm create @caveman-ai/agent`) accepts --provider <name>, consuming the next argv token as its value. If the next token is missing or itself starts with `--`, the value is rejected immediately rather than silently misparsed. This is argument-validation before any scaffolding or network work happens.","triggerScenarios":"Running `npm create @caveman-ai/agent@latest myapp --provider` (no value), or `--provider --no-install` where the flag is followed by another flag.","commonSituations":"Shell quoting that swallows the value, users assuming --provider=anthropic works and then appending a dangling flag, copy-pasting a truncated command from docs, or npm eating the value when extra `--` separators are used.","solutions":["Supply the value: `npm create @caveman-ai/agent@latest myapp --provider anthropic`.","If you meant interactive selection, omit --provider entirely — the tool prompts when stdin/stdout are TTYs.","Check for stray `--` separators between npm and the args that shift the value out of position."],"exampleFix":"# before\nnpm create @caveman-ai/agent@latest myapp --provider\n# after\nnpm create @caveman-ai/agent@latest myapp --provider anthropic","handlingStrategy":"validation","validationCode":"// Validate argv shape before spawning the initializer\nfunction validProviderArgs(args: string[]): boolean {\n  const i = args.indexOf(\"--provider\");\n  if (i === -1) return true;\n  const v = args[i + 1];\n  return Boolean(v) && !v.startsWith(\"--\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair --provider with its value in the same quoted string pair.","In scripts, build args as an array to avoid quoting/omission mistakes.","Prefer the interactive prompt when unsure — omit --provider on a TTY."],"tags":["cli","arguments","validation"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}