{"record":{"id":"9e77dc792bad95dc","repo":"JuliusBrussee/caveman","slug":"label-sources-must-be-a-non-empty-list","errorCode":null,"errorMessage":"{label}: sources must be a non-empty list","messagePattern":"(.+?): sources must be a non-empty list","errorType":"validation","errorClass":"CatalogError","httpStatus":null,"severity":"error","filePath":"shared/provider-catalog/validate_catalog.py","lineNumber":158,"sourceCode":"        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:\n        raise CatalogError(f\"{label}: verified_at is in the future\")\n    if verified_at < now - timedelta(days=120):\n        raise CatalogError(f\"{label}: verified_at is older than 120 days\")\n    return identity[0], identity[1], identity[2]\n\n\ndef check_review_markers(text: str, label: str) -> None:\n    \"\"\"Refuse a catalog that still carries an unreviewed sync proposal.\n\n    YAML comments are invisible to the parsed rows, so this reads the raw file:\n    a rubber-stamped merge must not be able to advance price provenance while\n    the line saying \"nobody has confirmed this yet\" is still in the file.\n    \"\"\"","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/provider-catalog/validate_catalog.py#L140-L176","documentation":"Each row's 'sources' field must be a list containing at least one entry — these are the URLs documenting the provider's pricing/capabilities. An empty list, a non-list (string, null), or a missing value triggers this CatalogError.","triggerScenarios":"sources: [] in the catalog row; sources set to a single string instead of a one-element list; the key omitted so it defaults to null.","commonSituations":"Adding a placeholder row before finding documentation URLs; YAML list syntax errors collapsing the list; deleting the only source during cleanup without replacing it.","solutions":["Provide at least one source URL as a list, e.g. sources: [\"https://example.com/pricing\"]","Wrap a single URL string into a list","Remove the empty-list placeholder once a real documentation URL is available"],"exampleFix":"// before\nsources: []\n// after\nsources:\n  - https://docs.example.com/pricing","handlingStrategy":"validation","validationCode":"srcs = row.get(\"sources\")\nassert isinstance(srcs, list) and len(srcs) > 0, \"sources must be a non-empty list\"","typeGuard":"def has_sources(row):\n    srcs = row.get(\"sources\")\n    return isinstance(srcs, list) and len(srcs) > 0 and all(isinstance(s, str) for s in srcs)","tryCatchPattern":"try:\n    validate_catalog(rows)\nexcept CatalogError as e:\n    if \"sources must be a non-empty list\" in str(e):\n        add_source_url(row)\n    raise","preventionTips":["Never commit rows with empty sources; use a TODO draft outside the catalog","Wrap single URLs in a list on import","Require sources in the catalog schema"],"tags":["validation","schema","sources","empty"],"backgroundTag":"empty-required-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"}