chroma-core/chroma · error · ValueError
You must set a data loader on the collection if loading from
Error message
You must set a data loader on the collection if loading from URIs.
What it means
`collection.get(include=[..., "data"])` asks Chroma to load the raw content behind each stored URI. The collection must have a DataLoader configured (passed at creation via `data_loader=`); without one, Chroma has no way to fetch URI contents, so the request is rejected before reaching the server.
Source
Thrown at chromadb/api/models/CollectionCommon.py:277
self,
ids: Optional[OneOrMany[ID]],
where: Optional[Where],
where_document: Optional[WhereDocument],
include: Include,
) -> GetRequest:
# Unpack
unpacked_ids: Optional[IDs] = maybe_cast_one_to_many(target=ids)
filters = FilterSet(where=where, where_document=where_document)
# Validate
if unpacked_ids is not None:
validate_ids(ids=unpacked_ids)
validate_filter_set(filter_set=filters)
validate_include(include=include, dissalowed=["distances"])
if "data" in include and self._data_loader is None:
raise ValueError(
"You must set a data loader on the collection if loading from URIs."
)
# Prepare
request_include = include
# We need to include uris in the result from the API to load datas
if "data" in include and "uris" not in include:
request_include.append("uris")
return GetRequest(
ids=unpacked_ids,
where=filters["where"],
where_document=filters["where_document"],
include=request_include,
)
@validation_context("query")
def _validate_and_prepare_query_request(View on GitHub (pinned to aecdd12c8a)
Solutions
- Pass a data loader when creating/getting the collection: `client.get_or_create_collection(name="docs", data_loader=DefaultDataLoader())`
- Use a custom DataLoader (e.g. from chromadb.utils.data_loaders) matching your storage backend
- Drop "data" from include and fetch the URIs yourself, then load content with your own I/O
Example fix
# before col = client.get_or_create_collection(name="docs") col.get(include=["uris", "data"]) # ValueError # after from chromadb.utils.data_loaders import DefaultDataLoader col = client.get_or_create_collection(name="docs", data_loader=DefaultDataLoader()) col.get(include=["uris", "data"])
Defensive patterns
Strategy: validation
Validate before calling
include = ["metadatas", "documents"]
wants_data = "data" in include
# track loader presence at creation time in your own wrapper
if wants_data and not collection_has_data_loader:
include = [f for f in include if f != "data"] # or raise/report early
collection.get(include=include) Prevention
- Always create URI-backed collections with data_loader= so 'data' include is always valid
- Centralize collection creation in one factory that decides whether a data loader is attached
- Request 'uris' first, load content yourself, if you do not want a loader dependency
When it happens
Trigger: Calling `get()` (or `query()`) with `include` containing "data" on a collection created without `data_loader=`, e.g. `client.get_or_create_collection(name="docs")`.
Common situations: Adding `include=["data"]` to an existing get call after following an example that assumes a data loader, or creating the collection in one place (without the loader) and reading `data` in another.
Related errors
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/469f5280092bc2ab.
Report an issue: GitHub.