chroma-core/chroma · error · TypeError

limit must be a Limit object, dict, int, or None, got

Error message

limit must be a Limit object, dict, int, or None, got {type(limit).__name__}

What it means

Raised by the plan constructor when the limit argument is not a Limit object, a dict (for Limit.from_dict), a plain int (shorthand for limit with offset 0), or None. Other types such as strings or floats are invalid pagination limits.

Solutions

  1. Pass an int, a dict like {"limit": 10, "offset": 0}, a Limit object, or None
  2. Convert floats or numeric strings to int before passing
  3. Don't pass other sequence types expecting pagination semantics
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at chromadb/execution/expression/plan.py:140 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/9d679e088e6fd48f. Report an issue: GitHub.

Appendix: source

Thrown at chromadb/execution/expression/plan.py:140

            self._group_by = group_by
        elif isinstance(group_by, dict):
            self._group_by = GroupBy.from_dict(group_by)
        else:
            raise TypeError(
                f"group_by must be a GroupBy object, dict, or None, got {type(group_by).__name__}"
            )

        # Handle limit parameter
        if limit is None:
            self._limit = Limit()
        elif isinstance(limit, Limit):
            self._limit = limit
        elif isinstance(limit, int):
            self._limit = Limit.from_dict({"limit": limit, "offset": 0})
        elif isinstance(limit, dict):
            self._limit = Limit.from_dict(limit)
        else:
            raise TypeError(
                f"limit must be a Limit object, dict, int, or None, got {type(limit).__name__}"
            )

        # Handle select parameter
        if select is None:
            self._select = Select()
        elif isinstance(select, Select):
            self._select = select
        elif isinstance(select, dict):
            self._select = Select.from_dict(select)
        elif isinstance(select, (list, set)):
            # Convert list/set of strings to Select object
            self._select = Select.from_dict({"keys": list(select)})
        else:
            raise TypeError(
                f"select must be a Select object, dict, list, set, or None, got {type(select).__name__}"
            )

View on GitHub (pinned to aecdd12c8a)