{"record":{"id":"fc06ccf5d9a68a5d","repo":"JuliusBrussee/caveman","slug":"caveman-code-no-supported-provider-credential-fou","errorCode":null,"errorMessage":"caveman-code: no supported provider credential found; set ANTHROPIC_API_KEY, OPENAI_API_KEY, or GEMINI_API_KEY","messagePattern":"caveman-code: no supported provider credential found; set ANTHROPIC_API_KEY, OPENAI_API_KEY, or GEMINI_API_KEY","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/agent/src/code.ts","lineNumber":562,"sourceCode":"}\n\nfunction resolveCodingModelID(explicit: string | undefined): string {\n  const requested = explicit ?? process.env.CAVE_MODEL;\n  if (requested !== undefined && requested !== \"\") {\n    const slash = requested.indexOf(\"/\");\n    if (slash <= 0 || slash === requested.length - 1) {\n      throw new Error(\"caveman-code: model must use provider/model format\");\n    }\n    return requested;\n  }\n  const configured: string[] = [];\n  if (process.env.ANTHROPIC_API_KEY) configured.push(\"anthropic/claude-sonnet-4-6\");\n  if (process.env.OPENAI_API_KEY) configured.push(\"openai/gpt-5.5\");\n  if (process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY) {\n    configured.push(\"google/gemini-2.5-pro\");\n  }\n  if (configured.length !== 1) {\n    throw new Error(\n      configured.length === 0\n        ? \"caveman-code: no supported provider credential found; set ANTHROPIC_API_KEY, OPENAI_API_KEY, or GEMINI_API_KEY\"\n        : \"caveman-code: multiple provider credentials found; set CAVE_MODEL to pick one\",\n    );\n  }\n  return configured[0]!;\n}\n\n// ---------------------------------------------------------------------------\n// Session\n// ---------------------------------------------------------------------------\n\nexport type SessionMode = \"optimized\" | \"observe-only\";\n\nexport interface CodingSessionOptions {\n  conversation?: ConversationState;\n  cave?: \"auto\" | \"off\";\n  gatewayURL?: string;","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/agent/src/code.ts#L544-L580","documentation":"With no explicit model requested, the agent infers the provider from which credential env vars are present (ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY/GOOGLE_API_KEY). Zero credentials means there is no model it can legally call, so resolution fails before any network attempt.","triggerScenarios":"Starting a coding session with none of ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, or GOOGLE_API_KEY set (or all set to empty strings), and no explicit model / CAVE_MODEL override.","commonSituations":"Env vars not passed into Docker (`docker run` without -e or env_file); secrets loaded asynchronously after startup; CI job that forgot the secret step; local .env file not sourced.","solutions":["Export exactly one provider credential, e.g. `export ANTHROPIC_API_KEY=sk-ant-...`","If using Docker/k8s, verify the variable actually reaches the process: `docker exec <c> env | grep -c _API_KEY`","Alternatively set CAVE_MODEL with an explicit provider/model if your gateway handles auth another way"],"exampleFix":"# before\nnode agent.js  # no keys in env\n\n# after\nexport ANTHROPIC_API_KEY=\"sk-ant-...\"\nnode agent.js","handlingStrategy":"validation","validationCode":"const CREDENTIAL_VARS = [\"ANTHROPIC_API_KEY\", \"OPENAI_API_KEY\", \"GEMINI_API_KEY\", \"GOOGLE_API_KEY\"] as const;\nconst present = CREDENTIAL_VARS.filter((v) => process.env[v] && process.env[v] !== \"\");\nif (present.length === 0) {\n  throw new Error(`no provider credential; export one of: ${CREDENTIAL_VARS.join(\", \")}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fail fast at boot: assert at least one credential env var before creating a session","In containers, use env_file or explicit -e flags and verify with a startup env check","Never assume ambient shell env reaches the process — pass secrets explicitly"],"tags":["config","credentials","env","auth"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}