chroma-core/chroma · error · NotImplementedError

Fork count is not implemented for SegmentAPI

Error message

Fork count is not implemented for SegmentAPI

What it means

SegmentAPI._fork_count (chromadb/api/segment.py:464) is a stub that raises NotImplementedError. Fork lineage counting is a Chroma-server capability; the embedded SegmentAPI backend (default for PersistentClient/EphemeralClient) keeps no fork records, so Collection.fork_count() always fails there.

Source

Thrown at chromadb/api/segment.py:464

    def _fork(
        self,
        collection_id: UUID,
        new_name: str,
        tenant: str = DEFAULT_TENANT,
        database: str = DEFAULT_DATABASE,
    ) -> CollectionModel:
        raise NotImplementedError(
            "Collection forking is not implemented for SegmentAPI"
        )

    @override
    def _fork_count(
        self,
        collection_id: UUID,
        tenant: str = DEFAULT_TENANT,
        database: str = DEFAULT_DATABASE,
    ) -> int:
        raise NotImplementedError("Fork count is not implemented for SegmentAPI")

    @override
    def _get_indexing_status(
        self,
        collection_id: UUID,
        tenant: str = DEFAULT_TENANT,
        database: str = DEFAULT_DATABASE,
    ) -> "IndexingStatus":
        raise NotImplementedError("Indexing status is not implemented for SegmentAPI")

    @override
    def _search(
        self,
        collection_id: UUID,
        searches: List[Search],
        tenant: str = DEFAULT_TENANT,
        database: str = DEFAULT_DATABASE,
        read_level: ReadLevel = ReadLevel.INDEX_AND_WAL,

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. Call fork_count through chromadb.HttpClient against a Chroma server
  2. Maintain your own fork registry (e.g. metadata on each forked collection recording its parent)
  3. Skip or short-circuit the metric when running embedded

Example fix

# before (raises NotImplementedError)
count = client.get_collection('docs').fork_count()

# after
from chromadb.errors import ChromaError
try:
    count = client.get_collection('docs').fork_count()
except NotImplementedError:
    count = 0  # embedded SegmentAPI has no fork lineage
Defensive patterns

Strategy: try-catch

Validate before calling

def fork_count_safe(collection, default: int = 0) -> int:
    try:
        return collection.fork_count()
    except NotImplementedError:
        return default  # SegmentAPI / embedded backends keep no fork lineage

Try / catch

try:
    count = collection.fork_count()
except NotImplementedError:
    count = 0  # embedded mode: forks not supported

Prevention

When it happens

Trigger: client = chromadb.PersistentClient(...); client.get_collection('docs').fork_count() (or the async equivalent) - any fork_count call routed to SegmentAPI.

Common situations: Usage accounting or lineage reporting written against a server deployment and re-run locally; shared admin tooling across deployment modes.

Related errors


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