{"record":{"id":"90257a76afd8403b","repo":"JuliusBrussee/caveman","slug":"label-field-must-be-a-safe-non-empty-identifi","errorCode":null,"errorMessage":"{label}: {field} must be a safe non-empty identifier","messagePattern":"(.+?): (.+?) must be a safe non-empty identifier","errorType":"validation","errorClass":"CatalogError","httpStatus":null,"severity":"error","filePath":"shared/provider-catalog/validate_catalog.py","lineNumber":128,"sourceCode":"        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:\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","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/provider-catalog/validate_catalog.py#L110-L146","documentation":"One of provider, model, or region is not a string matching the IDENTIFIER regex `^[A-Za-z0-9][A-Za-z0-9._:@/-]*$` — i.e. not a safe, non-empty, alphanumeric-leading identifier. These three fields form the row's identity (used for duplicate detection and snapshot pinning), so unsafe characters or empty values are rejected. Thrown from validate_row.","triggerScenarios":"A row has an empty string, a leading special character (`-anthropic`), spaces (`\"gpt 4o\"`), non-ASCII characters, or a non-string value (null, number) for provider/model/region.","commonSituations":"Pasting a display name with spaces or uppercase-mangled characters; a script substituting an empty value for a missing env var; using a URL as the provider; quoting quirks leaving a null where a name was expected.","solutions":["Use the canonical identifier form: start with a letter/digit, then only letters, digits, and `._:@/-` (e.g. `gpt-4o`, `us-east-1`)","Replace spaces with hyphens and drop or replace disallowed characters","Ensure the value is a non-empty string, not null or a number","Match the exact identifier used elsewhere in the catalog for the same provider/model/region"],"exampleFix":"# before\nmodel: \"gpt 4o (turbo)\"\n\n# after\nmodel: gpt-4o","handlingStrategy":"validation","validationCode":"import re\nIDENTIFIER = re.compile(r\"^[A-Za-z0-9][A-Za-z0-9._:@/-]*$\")\n\ndef identity_fields_ok(row: dict) -> bool:\n    return all(isinstance(row.get(f), str) and IDENTIFIER.fullmatch(row[f])\n               for f in (\"provider\", \"model\", \"region\"))","typeGuard":"def is_safe_identifier(value: object) -> bool:\n    return isinstance(value, str) and bool(IDENTIFIER.fullmatch(value))","tryCatchPattern":"try:\n    validate_catalog()\nexcept CatalogError as e:\n    if \"safe non-empty identifier\" in str(e):\n        sanitize_identity_field(str(e))","preventionTips":["Use canonical short names (gpt-4o, us-east-1), never display names or URLs","Run the IDENTIFIER regex over script-generated values before writing YAML","Check for empty strings when values come from env vars or templates"],"tags":["identifier","validation","yaml","catalog"],"backgroundTag":"invalid-identifier-format","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"}