{"record":{"id":"236ece813cc5a956","repo":"JuliusBrussee/caveman","slug":"label-missing-field-s-join-sorted-missi","errorCode":null,"errorMessage":"{label}: missing field(s): {', '.join(sorted(missing))}","messagePattern":"(.+?): missing field\\(s\\): (.+?)","errorType":"validation","errorClass":"CatalogError","httpStatus":null,"severity":"error","filePath":"shared/provider-catalog/validate_catalog.py","lineNumber":122,"sourceCode":"    elif isinstance(value, str):\n        try:\n            parsed = datetime.fromisoformat(value.replace(\"Z\", \"+00:00\"))\n        except ValueError as error:\n            raise CatalogError(f\"{label}: verified_at must be RFC3339\") from error\n    else:\n        raise CatalogError(f\"{label}: verified_at must be an RFC3339 timestamp\")\n    if parsed.tzinfo is None:\n        raise CatalogError(f\"{label}: verified_at must include a timezone\")\n    return parsed.astimezone(timezone.utc)\n\n\ndef validate_row(row: dict[str, Any], label: str, now: datetime) -> tuple[str, str, str]:\n    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:","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/provider-catalog/validate_catalog.py#L104-L140","documentation":"A required top-level field is absent from a catalog row. Every row must carry provider, model, region, currency, pricing, capabilities, sources, and verified_at (capabilities_verified_at is optional); a missing key means the row cannot be identified, priced, or snapshot-pinned. Thrown from validate_row.","triggerScenarios":"validate_row computes `REQUIRED_KEYS - set(row)` non-empty, e.g. a newly added row forgetting `sources`, a snapshot row copied without `verified_at`, or a bulk edit deleting a key. The message lists exactly which fields are missing.","commonSituations":"Adding a new model row by hand and forgetting one of the eight fields; a sync script emitting partial rows; deleting a field during a merge-conflict resolution; copying a row template that predates a required field.","solutions":["Add the listed missing field(s) to the row, copying structure from a neighboring valid row","For pricing fields that don't apply, include them inside `pricing` as explicit null rather than omitting row-level keys","If a sync script produced the row, fix its template to emit all required keys","Run the validator again — it reports all missing fields for the row at once"],"exampleFix":"# before\n- provider: openai\n  model: gpt-4o\n  region: global\n\n# after\n- provider: openai\n  model: gpt-4o\n  region: global\n  currency: USD\n  pricing: {input_per_million: 2.5, output_per_million: 10.0}\n  capabilities: {}\n  sources: [\"https://openai.com/pricing\"]\n  verified_at: \"2026-07-05T00:00:00Z\"","handlingStrategy":"validation","validationCode":"REQUIRED_KEYS = {\"provider\",\"model\",\"region\",\"currency\",\"pricing\",\"capabilities\",\"sources\",\"verified_at\"}\n\ndef all_required_present(row: dict) -> bool:\n    return not (REQUIRED_KEYS - set(row))","typeGuard":"def is_complete_row(row: object) -> bool:\n    return isinstance(row, dict) and REQUIRED_KEYS.issubset(row)","tryCatchPattern":"try:\n    validate_catalog()\nexcept CatalogError as e:\n    if \"missing field(s)\" in str(e):\n        fill_missing_fields(str(e))","preventionTips":["Start new rows from a copy of an existing complete row","Run the validator locally before every catalog commit","Keep sync-script row templates in sync with REQUIRED_KEYS"],"tags":["schema-validation","yaml","missing-field","catalog"],"backgroundTag":"schema-validation-failed","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"}