{"record":{"id":"5c677f7a514b0ff0","repo":"JuliusBrussee/caveman","slug":"cave-provider-usage-unpriced","errorCode":"cave_provider_usage_unpriced","errorMessage":"cave_provider_usage_unpriced","messagePattern":"cave_provider_usage_unpriced","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent/src/execution-kernel.ts","lineNumber":162,"sourceCode":"  ];\n  const disjointTotal = evidence.inputTokens + evidence.outputTokens +\n    evidence.cacheReadTokens + evidence.cacheWriteTokens;\n  if (values.some((value) => !Number.isSafeInteger(value) || value < 0) ||\n      evidence.totalTokens <= 0 || evidence.totalTokens !== disjointTotal ||\n      evidence.reasoningTokens > evidence.outputTokens) {\n    throw new Error(\"cave_provider_usage_incomplete\");\n  }\n  const priced = catalogCost({\n    provider: evidence.provider,\n    model: evidence.model,\n    inputTokens: evidence.inputTokens,\n    outputTokens: evidence.outputTokens,\n    cacheReadTokens: evidence.cacheReadTokens,\n    cacheWriteTokens: evidence.cacheWriteTokens,\n    reasoningTokens: evidence.reasoningTokens,\n  });\n  if (!priced.priced && options.requirePriced === true) {\n    throw new Error(\"cave_provider_usage_unpriced\");\n  }\n  if (options.reportedCostUsd !== undefined &&\n      (!priced.priced || !Number.isFinite(options.reportedCostUsd) ||\n        options.reportedCostUsd < 0 ||\n        Math.abs(options.reportedCostUsd - priced.usd) > 1e-12)) {\n    throw new Error(\"cave_provider_cost_mismatch\");\n  }\n  return Object.freeze({\n    ...evidence,\n    priced: priced.priced,\n    catalogCostUsd: priced.priced ? priced.usd : 0,\n  });\n}\n","sourceCodeStart":144,"sourceCodeEnd":176,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/agent/src/execution-kernel.ts#L144-L176","documentation":"validateProviderUsage throws cave_provider_usage_unpriced when the cost catalog has no price entry for the evidence's provider/model and options.requirePriced === true. The kernel refuses to accept usage it cannot price when pricing is mandatory.","triggerScenarios":"Calling priced()/usage()/validateExecution() with requirePriced:true for a model absent from catalogCost's price table (new/unreleased model, custom fine-tune, typo'd model id).","commonSituations":"Using a freshly released model before the library's cost catalog is updated; local/self-hosted models with no pricing entry; misspelled model identifiers like 'gpt4o'.","solutions":["Upgrade the library to a version whose cost catalog includes the model","Drop requirePriced (or set it false) if pricing is optional for this call","Check the model string for typos and use the exact catalog name","Register/patch the pricing entry for custom models if the API allows it"],"exampleFix":"// before\nkernel.usage(evidence, { requirePriced: true }); // model not in catalog\n// after\nkernel.usage(evidence, { requirePriced: false }); // or update to a cataloged model","handlingStrategy":"validation","validationCode":"if (requirePriced && !catalogHas(provider, model)) throw new Error(\"model not priced; adjust before calling\");","typeGuard":"null","tryCatchPattern":"try { kernel.usage(evidence, { requirePriced: true }); } catch (err) { if (err.message === \"cave_provider_usage_unpriced\") { logger.warn(\"unpriced model\", evidence.model); return { ...evidence, priced: false }; } throw err; }","preventionTips":["Keep the cost catalog current with library upgrades","Validate model ids against the catalog at config load time","Only set requirePriced:true when pricing is a hard requirement","Watch changelogs for newly cataloged models"],"tags":["pricing","cost-catalog","provider-usage"],"backgroundTag":"unsupported-operation","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"}