JuliusBrussee/caveman · error
unsupported provider ${JSON.stringify(value)}
Error message
unsupported provider ${JSON.stringify(value)} What it means
parseProvider normalizes (trim + lowercase) its input and accepts exactly 'anthropic', 'openai', or 'google'. Anything else — including values passed via --provider or typed at the interactive prompt — throws with the JSON.stringify'd original value so whitespace or case surprises are visible. This runs before any scaffold files are written.
Source
Thrown at packages/create-caveman-agent/src/index.ts:302
npm run check
\`\`\`
Local results are inferred. Verified savings remain $0 until active real
traffic passes existing Caveman rollout and ledger gates.
`,
};
}
function credentialName(provider: Provider): string {
if (provider === "anthropic") return "ANTHROPIC_API_KEY";
if (provider === "openai") return "OPENAI_API_KEY";
return "GEMINI_API_KEY (or GOOGLE_API_KEY)";
}
function parseProvider(value: string): Provider {
const normalized = value.trim().toLowerCase();
if (normalized === "anthropic" || normalized === "openai" || normalized === "google") return normalized;
throw new Error(`unsupported provider ${JSON.stringify(value)}`);
}
function safeName(value: string): string {
const normalized = value.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
if (!normalized) throw new Error("project name must contain a letter or number");
return normalized.slice(0, 96);
}
async function assertAbsent(path: string): Promise<void> {
try {
await stat(path);
throw new Error(`target already exists: ${path}`);
} catch (error) {
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
}
}
main().catch((error) => {View on GitHub (pinned to 27d5a3981a)
Solutions
- Use one of the three canonical values: anthropic, openai, google (case-insensitive).
- For Gemini, pass --provider google, not gemini.
- Check the echoed JSON in the error for hidden whitespace or quote characters and retype the flag.
Example fix
# before npm create @caveman-ai/agent@latest myapp --provider gemini # after npm create @caveman-ai/agent@latest myapp --provider google
Defensive patterns
Strategy: type-guard
Validate before calling
const PROVIDERS = new Set(["anthropic", "openai", "google"]);
function isProvider(v: string): boolean {
return PROVIDERS.has(v.trim().toLowerCase());
} Type guard
type Provider = "anthropic" | "openai" | "google";
function isProvider(value: string): value is Provider {
return ["anthropic", "openai", "google"].includes(value.trim().toLowerCase());
} Prevention
- Use the canonical keys: anthropic, openai, google (gemini is NOT accepted).
- Type flags as Provider in TS and validate before spawning the initializer.
- Type provider values by hand; avoid copy-paste from rich text that swaps quote characters.
When it happens
Trigger: `--provider Azure`, `--provider anthropic ` with smart quotes, `--provider gemini` (the accepted name is 'google'), or answering 'claude' at the interactive prompt.
Common situations: Using the model-vendor name instead of the provider key (gemini vs google, claude vs anthropic), trailing whitespace from copy-paste, or non-ASCII quotes introduced by rich-text editors/chat apps.
Related errors
- cave_provider_identity_missing
- cave_provider_model_identity_mismatch
- ${key} is required
- --provider requires a value
- unknown option ${value}
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/831db31402b0dcab.
Report an issue: GitHub.