JuliusBrussee/caveman · error · CatalogError
: pricing. must be numeric or null
Error message
{label}: pricing.{field} must be numeric or null What it means
Every non-boolean pricing field (input_per_million, output_per_million, cache_read/write multipliers, batch_discount_fraction, etc.) must be numeric (int/float) or null. Strings, dicts, lists, or booleans raise this CatalogError; booleans are explicitly rejected because bool is a subclass of int in Python.
Solutions
- Convert the value to an unquoted number (e.g. 3.0 not "3.0")
- Use null if the price is genuinely unknown/not applicable
- Check upstream import/transform code that the value isn't passed as str or bool
Example fix
// before pricing: input_per_million: "3.0" // after pricing: input_per_million: 3.0
Defensive patterns
Strategy: type-guard
Validate before calling
for k, v in pricing.items():
if k == "long_context_threshold_inclusive":
continue
assert v is None or (isinstance(v, (int, float)) and not isinstance(v, bool)), k Type guard
def is_num_or_none(v):
return v is None or (isinstance(v, (int, float)) and not isinstance(v, bool)) Try / catch
try:
validate_catalog(rows)
except CatalogError as e:
if "must be numeric or null" in str(e):
coerce_pricing_numbers(rows)
raise Prevention
- Unquote numbers in YAML/JSON
- Cast to float() at import boundaries
- Reject bools explicitly (bool is an int subclass in Python)
When it happens
Trigger: A pricing field like input_per_million is set to "3.0" (string), true, or a nested object; a numeric field received a bool from a transform script.
Common situations: Prices quoted in YAML ("3.0" instead of 3.0); CSV imports delivering prices as strings; templating that stringifies numbers; JSON Schema edits putting objects where numbers belong.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- : pricing. must be boolean or null
- : pricing. must be finite and nonnegative
- cave_budget_max_invalid
- filter must be a boolean
- filter must be a finite number
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/c1729b4aac739279.
Report an issue: GitHub.
Appendix: source
Thrown at shared/provider-catalog/validate_catalog.py:148
if row["currency"] != "USD":
raise CatalogError(f"{label}: currency must be USD")
pricing = row["pricing"]
if not isinstance(pricing, dict):
raise CatalogError(f"{label}: pricing must be an object")
pricing_unknown = set(pricing) - PRICING_KEYS
if pricing_unknown:
raise CatalogError(f"{label}: unknown pricing field(s): {', '.join(sorted(pricing_unknown))}")
for required in ("input_per_million", "output_per_million"):
if required not in pricing:
raise CatalogError(f"{label}: pricing.{required} is required")
for field, value in pricing.items():
if value is None or field == "long_context_threshold_inclusive":
if field == "long_context_threshold_inclusive" and value is not None and not isinstance(value, bool):
raise CatalogError(f"{label}: pricing.{field} must be boolean or null")
continue
if isinstance(value, bool) or not isinstance(value, (int, float)):
raise CatalogError(f"{label}: pricing.{field} must be numeric or null")
if not math.isfinite(value) or value < 0:
raise CatalogError(f"{label}: pricing.{field} must be finite and nonnegative")
if field == "batch_discount_fraction" and value > 1:
raise CatalogError(f"{label}: pricing.batch_discount_fraction must be <= 1")
if not isinstance(row["capabilities"], dict):
raise CatalogError(f"{label}: capabilities must be an object")
sources = row["sources"]
if not isinstance(sources, list) or not sources:
raise CatalogError(f"{label}: sources must be a non-empty list")
if any(not isinstance(source, str) or not source.startswith("https://") for source in sources):
raise CatalogError(f"{label}: every source must be HTTPS")
verified_at = parsed_time(row["verified_at"], label)
if verified_at > now:
raise CatalogError(f"{label}: verified_at is in the future")
if verified_at < now - timedelta(days=120):
raise CatalogError(f"{label}: verified_at is older than 120 days")View on GitHub (pinned to 3ee70a1026)