JuliusBrussee/caveman · error
--provider requires a value
Error message
--provider requires a value
What it means
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.
Source
Thrown at packages/create-caveman-agent/src/index.ts:67
"npm run dev",
"eval starts unapproved; inspect it, set approved: true, then npm run build",
"",
].join("\n"));
}
function parseArgs(args: string[]): {
target: string;
provider?: string;
install: boolean;
} {
let provider: string | undefined;
let install = true;
const positional: string[] = [];
for (let index = 0; index < args.length; index++) {
const value = args[index]!;
if (value === "--provider") {
const candidate = args[++index];
if (!candidate || candidate.startsWith("--")) throw new Error("--provider requires a value");
provider = candidate;
continue;
}
if (value === "--no-install") {
install = false;
continue;
}
if (value.startsWith("--")) throw new Error(`unknown option ${value}`);
positional.push(value);
}
if (positional.length !== 1) {
throw new Error(
USAGE,
);
}
return {
target: positional[0]!,
...(provider === undefined ? {} : { provider }),View on GitHub (pinned to 27d5a3981a)
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.
Example fix
# before npm create @caveman-ai/agent@latest myapp --provider # after npm create @caveman-ai/agent@latest myapp --provider anthropic
Defensive patterns
Strategy: validation
Validate before calling
// Validate argv shape before spawning the initializer
function validProviderArgs(args: string[]): boolean {
const i = args.indexOf("--provider");
if (i === -1) return true;
const v = args[i + 1];
return Boolean(v) && !v.startsWith("--");
} Prevention
- 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.
When it happens
Trigger: Running `npm create @caveman-ai/agent@latest myapp --provider` (no value), or `--provider --no-install` where the flag is followed by another flag.
Common situations: 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.
Related errors
- ${key} is required
- unknown option ${value}
- unknown command ${JSON.stringify(command)}; run caveman-agen
- cave_subagent_arguments_invalid
- usage: npm create @caveman-ai/agent@latest <project> [--prov
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/ada48bfbb8c529a1.
Report an issue: GitHub.