chroma-core/chroma · error · TypeError

$contains requires a str, int, float, or bool, got {type(val

Error message

$contains requires a str, int, float, or bool, got {type(value).__name__}

What it means

Error "$contains requires a str, int, float, or bool, got {type(value).__name__}" thrown in chroma-core/chroma.

Source

Thrown at chromadb/execution/expression/operator.py:189

                elif op == "$lt":
                    return Key(field) < value
                elif op == "$lte":
                    return Key(field) <= value
                elif op == "$in":
                    if not isinstance(value, list):
                        raise TypeError(
                            f"$in requires a list, got {type(value).__name__}"
                        )
                    return Key(field).is_in(value)
                elif op == "$nin":
                    if not isinstance(value, list):
                        raise TypeError(
                            f"$nin requires a list, got {type(value).__name__}"
                        )
                    return Key(field).not_in(value)
                elif op == "$contains":
                    if not isinstance(value, (str, int, float, bool)):
                        raise TypeError(
                            f"$contains requires a str, int, float, or bool, got {type(value).__name__}"
                        )
                    return Key(field).contains(value)
                elif op == "$not_contains":
                    if not isinstance(value, (str, int, float, bool)):
                        raise TypeError(
                            f"$not_contains requires a str, int, float, or bool, got {type(value).__name__}"
                        )
                    return Key(field).not_contains(value)
                elif op == "$regex":
                    if not isinstance(value, str):
                        raise TypeError(
                            f"$regex requires a string pattern, got {type(value).__name__}"
                        )
                    return Key(field).regex(value)
                elif op == "$not_regex":
                    if not isinstance(value, str):
                        raise TypeError(

View on GitHub (pinned to aecdd12c8a)

When it happens

Trigger: Thrown at chromadb/execution/expression/operator.py:189 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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