{"record":{"id":"9c0b36d0083929bd","repo":"JuliusBrussee/caveman","slug":"label-pricing-required-is-required","errorCode":null,"errorMessage":"{label}: pricing.{required} is required","messagePattern":"(.+?): pricing\\.(.+?) is required","errorType":"validation","errorClass":"CatalogError","httpStatus":null,"severity":"error","filePath":"shared/provider-catalog/validate_catalog.py","lineNumber":141,"sourceCode":"\n    identity: list[str] = []\n    for field in (\"provider\", \"model\", \"region\"):\n        value = row[field]\n        if not isinstance(value, str) or not IDENTIFIER.fullmatch(value):\n            raise CatalogError(f\"{label}: {field} must be a safe non-empty identifier\")\n        identity.append(value)\n    if row[\"currency\"] != \"USD\":\n        raise CatalogError(f\"{label}: currency must be USD\")\n\n    pricing = row[\"pricing\"]\n    if not isinstance(pricing, dict):\n        raise CatalogError(f\"{label}: pricing must be an object\")\n    pricing_unknown = set(pricing) - PRICING_KEYS\n    if pricing_unknown:\n        raise CatalogError(f\"{label}: unknown pricing field(s): {', '.join(sorted(pricing_unknown))}\")\n    for required in (\"input_per_million\", \"output_per_million\"):\n        if required not in pricing:\n            raise CatalogError(f\"{label}: pricing.{required} is required\")\n    for field, value in pricing.items():\n        if value is None or field == \"long_context_threshold_inclusive\":\n            if field == \"long_context_threshold_inclusive\" and value is not None and not isinstance(value, bool):\n                raise CatalogError(f\"{label}: pricing.{field} must be boolean or null\")\n            continue\n        if isinstance(value, bool) or not isinstance(value, (int, float)):\n            raise CatalogError(f\"{label}: pricing.{field} must be numeric or null\")\n        if not math.isfinite(value) or value < 0:\n            raise CatalogError(f\"{label}: pricing.{field} must be finite and nonnegative\")\n        if field == \"batch_discount_fraction\" and value > 1:\n            raise CatalogError(f\"{label}: pricing.batch_discount_fraction must be <= 1\")\n\n    if not isinstance(row[\"capabilities\"], dict):\n        raise CatalogError(f\"{label}: capabilities must be an object\")\n    sources = row[\"sources\"]\n    if not isinstance(sources, list) or not sources:\n        raise CatalogError(f\"{label}: sources must be a non-empty list\")\n    if any(not isinstance(source, str) or not source.startswith(\"https://\") for source in sources):","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/provider-catalog/validate_catalog.py#L123-L159","documentation":"validate_row enforces that each catalog row's pricing object carries the two required cost keys: 'input_per_million' and 'output_per_million'. If either key is absent from the pricing dict, the catalog cannot compute per-token costs, so validation fails with this CatalogError. The {label} prefix identifies which row failed.","triggerScenarios":"A catalog row's pricing object omits 'input_per_million' or 'output_per_million' (e.g. pricing only has {\"batch_discount_fraction\": 0.5} or is missing one direction of the pricing).","commonSituations":"Hand-editing a provider catalog YAML/JSON and dropping a key; adding a new model row with a partially filled pricing block; a sync/merge tool writing partial pricing objects; copying a row and deleting a key that looked redundant.","solutions":["Add the missing 'input_per_million' and/or 'output_per_million' key to the row's pricing object with a finite nonnegative number (cost in currency per 1M tokens)","Diff the row against a sibling row of the same provider to spot the dropped key","If the model is free, set the key explicitly to 0 rather than omitting it","Re-run validate_catalog to confirm the row passes"],"exampleFix":"// before\npricing:\n  input_per_million: 3.0\n// after\npricing:\n  input_per_million: 3.0\n  output_per_million: 15.0","handlingStrategy":"validation","validationCode":"def has_required_pricing(pricing):\n    return isinstance(pricing, dict) and \"input_per_million\" in pricing and \"output_per_million\" in pricing","typeGuard":"def is_valid_pricing(p):\n    return isinstance(p, dict) and all(k in p for k in (\"input_per_million\", \"output_per_million\"))","tryCatchPattern":"try:\n    validate_catalog(rows)\nexcept CatalogError as e:\n    print(f\"fix catalog row: {e}\")","preventionTips":["Use a JSON/YAML schema that marks both pricing keys required","Copy new rows from a known-valid template row","Run the validator in CI on every catalog change"],"tags":["validation","schema","pricing","catalog"],"backgroundTag":"missing-required-config-field","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"}