{"record":{"id":"49179d279d111d2f","repo":"JuliusBrussee/caveman","slug":"label-pricing-must-be-an-object","errorCode":null,"errorMessage":"{label}: pricing must be an object","messagePattern":"(.+?): pricing must be an object","errorType":"validation","errorClass":"CatalogError","httpStatus":null,"severity":"error","filePath":"shared/provider-catalog/validate_catalog.py","lineNumber":135,"sourceCode":"    unknown = set(row) - TOP_LEVEL_KEYS\n    missing = REQUIRED_KEYS - set(row)\n    if unknown:\n        raise CatalogError(f\"{label}: unknown field(s): {', '.join(sorted(unknown))}\")\n    if missing:\n        raise CatalogError(f\"{label}: missing field(s): {', '.join(sorted(missing))}\")\n\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","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/provider-catalog/validate_catalog.py#L117-L153","documentation":"A row's `pricing` value is not a mapping (dict). Pricing must be an object whose keys are the known per-million rate fields; a scalar, list, or null cannot carry the rate data the cost engine reads. Thrown from validate_row.","triggerScenarios":"A row sets `pricing: 2.5` (a single rate instead of an object), `pricing: [2.5, 10]`, `pricing:` with nothing after it (YAML null), or indentation errors that collapse the pricing block into a string.","commonSituations":"Wrong indentation so the pricing sub-keys detach from `pricing:`; writing a flat number because only one rate was known; merge conflicts corrupting the block; a script emitting JSON arrays instead of objects.","solutions":["Make pricing a mapping with at least input_per_million and output_per_million keys","Restore indentation so rate keys sit under `pricing:` (two spaces deeper)","For rates that don't apply, use explicit `null` values inside the object instead of omitting or flattening","Copy the pricing block shape from a neighboring valid row"],"exampleFix":"# before\npricing: 2.5\n\n# after\npricing:\n  input_per_million: 2.5\n  output_per_million: 10.0\n  cache_read_input_per_million: null","handlingStrategy":"type-guard","validationCode":"def pricing_is_object(row: dict) -> bool:\n    return isinstance(row.get(\"pricing\"), dict)","typeGuard":"def is_pricing_object(value: object) -> bool:\n    return isinstance(value, dict) and \"input_per_million\" in value","tryCatchPattern":"try:\n    validate_catalog()\nexcept CatalogError as e:\n    if \"pricing must be an object\" in str(e):\n        restructure_pricing_block(str(e))","preventionTips":["Check indentation of the pricing block after hand edits","Never flatten pricing to a single number; use null for non-applicable rates","Diff YAML round-trip (load then dump) to catch structural drift"],"tags":["type-mismatch","yaml","pricing","catalog"],"backgroundTag":"type-mismatch","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"}