{"record":{"id":"831db31402b0dcab","repo":"JuliusBrussee/caveman","slug":"unsupported-provider-json-stringify-value","errorCode":null,"errorMessage":"unsupported provider ${JSON.stringify(value)}","messagePattern":"unsupported provider (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/create-caveman-agent/src/index.ts","lineNumber":302,"sourceCode":"npm run check\n\\`\\`\\`\n\nLocal results are inferred. Verified savings remain $0 until active real\ntraffic passes existing Caveman rollout and ledger gates.\n`,\n  };\n}\n\nfunction credentialName(provider: Provider): string {\n  if (provider === \"anthropic\") return \"ANTHROPIC_API_KEY\";\n  if (provider === \"openai\") return \"OPENAI_API_KEY\";\n  return \"GEMINI_API_KEY (or GOOGLE_API_KEY)\";\n}\n\nfunction parseProvider(value: string): Provider {\n  const normalized = value.trim().toLowerCase();\n  if (normalized === \"anthropic\" || normalized === \"openai\" || normalized === \"google\") return normalized;\n  throw new Error(`unsupported provider ${JSON.stringify(value)}`);\n}\n\nfunction safeName(value: string): string {\n  const normalized = value.toLowerCase().replace(/[^a-z0-9_-]+/g, \"-\").replace(/^-+|-+$/g, \"\");\n  if (!normalized) throw new Error(\"project name must contain a letter or number\");\n  return normalized.slice(0, 96);\n}\n\nasync function assertAbsent(path: string): Promise<void> {\n  try {\n    await stat(path);\n    throw new Error(`target already exists: ${path}`);\n  } catch (error) {\n    if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n  }\n}\n\nmain().catch((error) => {","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/create-caveman-agent/src/index.ts#L284-L320","documentation":"Thrown by parseProvider in the create-caveman-agent scaffolder: the provider string, after trim and lowercasing, is not one of 'anthropic', 'openai', or 'google'. The raw value is echoed via JSON.stringify so whitespace or case issues are visible.","triggerScenarios":"Passing an unsupported or misspelled provider: `--provider Anthropic-AI`, `--provider claude`, `--provider gpt`, `--provider gemini` (note: gemini is NOT accepted — use `google`).","commonSituations":"Assuming model/brand names (claude, gemini, gpt) map to providers; typo `anthrpoaic`; using camelCase with extra characters the trim/lowercase doesn't fix (e.g. internal spaces become part of the value).","solutions":["Use exactly one of: anthropic, openai, google (case-insensitive)","For Gemini/Google models pass `--provider google`, not `gemini`","Check for typos or stray whitespace/characters in the flag value"],"exampleFix":"// before\nnpm create @caveman-ai/agent@latest my-app -- --provider gemini\n// after\nnpm create @caveman-ai/agent@latest my-app -- --provider google","handlingStrategy":"validation","validationCode":"const PROVIDERS = new Set([\"anthropic\", \"openai\", \"google\"]);\nconst i = argv.indexOf(\"--provider\");\nif (i !== -1 && !PROVIDERS.has((argv[i + 1] ?? \"\").trim().toLowerCase())) {\n  throw new Error(`provider must be one of anthropic|openai|google`);\n}","typeGuard":"function isProvider(v: string): v is \"anthropic\" | \"openai\" | \"google\" {\n  return [\"anthropic\", \"openai\", \"google\"].includes(v.trim().toLowerCase());\n}","tryCatchPattern":"try {\n  const opts = parseArgs(argv);\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith(\"unsupported provider\")) {\n    console.error(`${error.message} — use anthropic, openai, or google`);\n    process.exitCode = 1;\n  } else throw error;\n}","preventionTips":["Use brand-agnostic names: google (not gemini), anthropic (not claude), openai (not gpt)","Validate provider strings in wrapper scripts before invoking the CLI","Tab-complete from the usage message rather than typing from memory"],"tags":["cli","validation","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}