JuliusBrussee/caveman · error · CatalogError

: capabilities must be an object

Error message

{label}: capabilities must be an object

What it means

Each catalog row must have a 'capabilities' key holding a dict/object of capability flags. If capabilities is missing its object shape (null, list, string, etc.), validate_row raises this CatalogError.

Solutions

  1. Reshape capabilities into an object with boolean keys, e.g. {vision: true, tools: true}
  2. Compare with an existing valid row's capabilities shape and mirror it
  3. In YAML, ensure capabilities: is followed by key: value mappings, not a dash list

Example fix

// before
capabilities:
  - vision
  - tools
// after
capabilities:
  vision: true
  tools: true
Defensive patterns

Strategy: validation

Validate before calling

assert isinstance(row.get("capabilities"), dict), "capabilities must be an object"

Type guard

def has_capabilities_dict(row):
    caps = row.get("capabilities")
    return isinstance(caps, dict) and all(isinstance(v, bool) for v in caps.values())

Try / catch

try:
    validate_catalog(rows)
except CatalogError as e:
    if "capabilities must be an object" in str(e):
        convert_capabilities_to_object(row)
    raise

Prevention

When it happens

Trigger: A row defines capabilities as a list (e.g. ["vision","tools"]), a string ("vision,tools"), or omits it so it resolves to null.

Common situations: Hand-writing a new row with a shorthand capability list; a schema migration turning the object into an array; YAML collapsing an empty capabilities block to null.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/ca77cb3983f0886b. Report an issue: GitHub.

Appendix: source

Thrown at shared/provider-catalog/validate_catalog.py:155

    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")
    return identity[0], identity[1], identity[2]


def check_review_markers(text: str, label: str) -> None:
    """Refuse a catalog that still carries an unreviewed sync proposal.

    YAML comments are invisible to the parsed rows, so this reads the raw file:

View on GitHub (pinned to 3ee70a1026)