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

  1. Supply the value: `npm create @caveman-ai/agent@latest myapp --provider anthropic`.
  2. If you meant interactive selection, omit --provider entirely — the tool prompts when stdin/stdout are TTYs.
  3. 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

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


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/ada48bfbb8c529a1. Report an issue: GitHub.