{"record":{"id":"9453e0b0b20d0b61","repo":"JuliusBrussee/caveman","slug":"caveman-agent-baseline-model-unavailable-provi","errorCode":null,"errorMessage":"caveman agent: baseline model unavailable: ${provider}/${id}","messagePattern":"caveman agent: baseline model unavailable: (.+?)/(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent/src/runtime.ts","lineNumber":3264,"sourceCode":"    const model = models.getModel(requested.slice(0, slash), requested.slice(slash + 1));\n    if (!model) throw new Error(`caveman agent: unknown model ${JSON.stringify(requested)}`);\n    return model;\n  }\n\n  const configured: Array<[string, string]> = [];\n  if (process.env.ANTHROPIC_API_KEY) configured.push([\"anthropic\", \"claude-haiku-4-5\"]);\n  if (process.env.OPENAI_API_KEY) configured.push([\"openai\", \"gpt-5.4-mini\"]);\n  if (process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY) configured.push([\"google\", \"gemini-2.5-flash\"]);\n  if (configured.length !== 1) {\n    throw new Error(\n      configured.length === 0\n        ? \"caveman agent: no supported provider credential found\"\n        : \"caveman agent: multiple provider credentials found; set CAVE_MODEL once\",\n    );\n  }\n  const [provider, id] = configured[0]!;\n  const model = models.getModel(provider, id);\n  if (!model) throw new Error(`caveman agent: baseline model unavailable: ${provider}/${id}`);\n  return model;\n}\n\nfunction localProviderModel(rootDir: string): string | undefined {\n  try {\n    const parsed = JSON.parse(readFileSync(resolve(rootDir, \".caveman/provider.json\"), \"utf8\")) as { model?: unknown };\n    return typeof parsed.model === \"string\" ? parsed.model : undefined;\n  } catch (error) {\n    if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return undefined;\n    throw new Error(\"caveman agent: invalid .caveman/provider.json\");\n  }\n}\n\n/**\n * Point a model at the gateway when the gateway speaks its dialect.\n *\n * The three routes below are the only ones the Caveman gateway proxies. Every\n * other provider Pi can reach (xai, groq, bedrock, openrouter, …) keeps its own","sourceCodeStart":3246,"sourceCodeEnd":3282,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/agent/src/runtime.ts#L3246-L3282","documentation":"When credentials imply exactly one baseline provider/model, the runtime resolves it via `models.getModel(provider, id)` and throws `caveman agent: baseline model unavailable: <provider>/<id>` if that pair is not registered. This is a registry-vs-catalog mismatch: your credential is recognized but the runtime has no model entry for the default it would pick.","triggerScenarios":"Only one provider key is set (e.g. `OPENAI_API_KEY`) and `models.getModel(\"openai\", \"gpt-5.4-mini\")` returns undefined — the runtime version predates or postdates that default id, or the model registry was trimmed.","commonSituations":"Version skew between the runtime package and its model registry; a fork/stub registry in tests; a runtime release where the baseline default id was renamed.","solutions":["Pin an explicitly registered model with `CAVE_MODEL=<provider>/<model>` (e.g. `anthropic/claude-haiku-4-5`) to bypass baseline selection.","Update the package/runtime so the registry contains the current baseline default.","Check which models `models.getModel` supports in your installed version and set a key for a provider whose baseline resolves."],"exampleFix":"// before\nexport OPENAI_API_KEY=...   # baseline openai/gpt-5.4-mini not in registry\n// after\nexport OPENAI_API_KEY=...\nexport CAVE_MODEL=openai/gpt-5.4-mini  # or upgrade the runtime","handlingStrategy":"fallback","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  await agent.run(task);\n} catch (e) {\n  if ((e as Error).message.startsWith(\"caveman agent: baseline model unavailable\")) {\n    console.error(\"Pin CAVE_MODEL to a registered model or update the runtime package\");\n  } else throw e;\n}","preventionTips":["Pin CAVE_MODEL explicitly instead of relying on credential-derived baseline defaults.","Keep the runtime package and its model registry in sync (upgrade together).","Run `doctor` after dependency updates to confirm provider/model readiness."],"tags":["model-selection","config","not-found"],"backgroundTag":"resource-not-found","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"}