{"record":{"id":"ef4bbaac0fb6cafe","repo":"JuliusBrussee/caveman","slug":"label-pricing-field-must-be-boolean-or-null","errorCode":null,"errorMessage":"{label}: pricing.{field} must be boolean or null","messagePattern":"(.+?): pricing\\.(.+?) must be boolean or null","errorType":"validation","errorClass":"CatalogError","httpStatus":null,"severity":"error","filePath":"shared/provider-catalog/validate_catalog.py","lineNumber":145,"sourceCode":"        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):\n        raise CatalogError(f\"{label}: every source must be HTTPS\")\n\n    verified_at = parsed_time(row[\"verified_at\"], label)\n    if verified_at > now:","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/provider-catalog/validate_catalog.py#L127-L163","documentation":"The pricing key 'long_context_threshold_inclusive' is the only pricing field allowed to be a boolean (it marks whether the long-context price threshold is inclusive). If it is present but is neither a boolean nor null, validate_row raises this CatalogError.","triggerScenarios":"A row's pricing contains long_context_threshold_inclusive set to a string like \"true\"/\"yes\", an int 0/1, or any non-bool non-null value.","commonSituations":"YAML/JSON values quoted as \"true\" (making them strings); converting a bool to 0/1 during a script transform; hand-typing the field and forgetting the schema expects an actual boolean.","solutions":["Change the value to a real boolean true/false (unquoted in YAML, no quotes in JSON)","Set it to null if the row has no long-context threshold","Remove surrounding quotes so YAML/JSON parses it as a boolean, not a string"],"exampleFix":"// before\npricing:\n  long_context_threshold_inclusive: \"true\"\n// after\npricing:\n  long_context_threshold_inclusive: true","handlingStrategy":"type-guard","validationCode":"v = pricing.get(\"long_context_threshold_inclusive\")\nassert v is None or isinstance(v, bool), \"must be boolean or null\"","typeGuard":"def is_bool_or_none(v):\n    return v is None or isinstance(v, bool)","tryCatchPattern":"try:\n    validate_catalog(rows)\nexcept CatalogError as e:\n    if \"long_context_threshold_inclusive\" in str(e):\n        fix_boolean_field(rows)\n    raise","preventionTips":["Never quote true/false in YAML","Coerce string \"true\"/\"false\" to bool in import scripts","Schema-check with type: [boolean, \"null\"]"],"tags":["validation","type-error","pricing","boolean"],"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"}