chroma-core/chroma · error · ValueError

At least one of one of {', '.join(record_set.keys())} must b

Error message

At least one of one of {', '.join(record_set.keys())} must be provided

What it means

Before add/update/upsert, Chroma validates the record set; _validate_record_set_length_consistency first requires that at least one field (ids, embeddings, metadatas, documents, uris, ...) be non-None. If every field is None it raises ValueError('At least one of one of {fields} must be provided') listing the record-set keys — the call carries no data at all.

Source

Thrown at chromadb/api/types.py:454


def validate_insert_record_set(record_set: InsertRecordSet) -> None:
    """
    Validates the InsertRecordSet, ensuring that all fields are of the right type and length.
    """
    _validate_record_set_length_consistency(record_set)
    validate_base_record_set(record_set)

    validate_ids(record_set["ids"])
    if record_set["metadatas"] is not None:
        validate_metadatas(record_set["metadatas"])


def _validate_record_set_length_consistency(record_set: BaseRecordSet) -> None:
    lengths = [len(lst) for lst in record_set.values() if lst is not None]  # type: ignore[arg-type]

    if not lengths:
        raise ValueError(
            f"At least one of one of {', '.join(record_set.keys())} must be provided"
        )

    zero_lengths = [
        key
        for key, lst in record_set.items()
        if lst is not None and len(lst) == 0  # type: ignore[arg-type]
    ]

    if zero_lengths:
        raise ValueError(f"Non-empty lists are required for {zero_lengths}")

    if len(set(lengths)) > 1:
        error_str = ", ".join(
            f"{key}: {len(lst)}"
            for key, lst in record_set.items()
            if lst is not None  # type: ignore[arg-type]
        )

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. Require ids at the wrapper level and skip empty batches: if not ids: return
  2. Validate any(v is not None for v in record.values()) before calling add/upsert
  3. Log the record set when validation fails so silent all-None dicts surface quickly

Example fix

// before
record = {k: v for k, v in batch.items() if v}  # can end up empty
coll.add(**record)  # ValueError: at least one field must be provided

// after
if any(v is not None for v in batch.values()):
    coll.add(**{k: v for k, v in batch.items() if v is not None})
Defensive patterns

Strategy: validation

Validate before calling

def add_record_set(coll, **fields):
    if all(v is None for v in fields.values()):
        raise ValueError(f'record set is empty: provide at least one of {sorted(fields)}')
    coll.add(**{k: v for k, v in fields.items() if v is not None})

Prevention

When it happens

Trigger: coll.add() with no arguments, or a dynamically built kwargs dict in which every value ended up None (all keys filtered out before the call).

Common situations: Dynamic batch builders that drop every key for degenerate rows; wrapper APIs forwarding **kwargs that collapsed to all-None; refactors that accidentally stop passing ids.

Related errors


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/792ead6f07d57016. Report an issue: GitHub.