{"record":{"id":"7b7c7513d3f55145","repo":"chroma-core/chroma","slug":"fork-count-is-not-implemented-for-segmentapi","errorCode":null,"errorMessage":"Fork count is not implemented for SegmentAPI","messagePattern":"Fork count is not implemented for SegmentAPI","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"chromadb/api/segment.py","lineNumber":464,"sourceCode":"    def _fork(\n        self,\n        collection_id: UUID,\n        new_name: str,\n        tenant: str = DEFAULT_TENANT,\n        database: str = DEFAULT_DATABASE,\n    ) -> CollectionModel:\n        raise NotImplementedError(\n            \"Collection forking is not implemented for SegmentAPI\"\n        )\n\n    @override\n    def _fork_count(\n        self,\n        collection_id: UUID,\n        tenant: str = DEFAULT_TENANT,\n        database: str = DEFAULT_DATABASE,\n    ) -> int:\n        raise NotImplementedError(\"Fork count is not implemented for SegmentAPI\")\n\n    @override\n    def _get_indexing_status(\n        self,\n        collection_id: UUID,\n        tenant: str = DEFAULT_TENANT,\n        database: str = DEFAULT_DATABASE,\n    ) -> \"IndexingStatus\":\n        raise NotImplementedError(\"Indexing status is not implemented for SegmentAPI\")\n\n    @override\n    def _search(\n        self,\n        collection_id: UUID,\n        searches: List[Search],\n        tenant: str = DEFAULT_TENANT,\n        database: str = DEFAULT_DATABASE,\n        read_level: ReadLevel = ReadLevel.INDEX_AND_WAL,","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/segment.py#L446-L482","documentation":"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.","triggerScenarios":"client = chromadb.PersistentClient(...); client.get_collection('docs').fork_count() (or the async equivalent) - any fork_count call routed to SegmentAPI.","commonSituations":"Usage accounting or lineage reporting written against a server deployment and re-run locally; shared admin tooling across deployment modes.","solutions":["Call fork_count through chromadb.HttpClient against a Chroma server","Maintain your own fork registry (e.g. metadata on each forked collection recording its parent)","Skip or short-circuit the metric when running embedded"],"exampleFix":"# before (raises NotImplementedError)\ncount = client.get_collection('docs').fork_count()\n\n# after\nfrom chromadb.errors import ChromaError\ntry:\n    count = client.get_collection('docs').fork_count()\nexcept NotImplementedError:\n    count = 0  # embedded SegmentAPI has no fork lineage","handlingStrategy":"try-catch","validationCode":"def fork_count_safe(collection, default: int = 0) -> int:\n    try:\n        return collection.fork_count()\n    except NotImplementedError:\n        return default  # SegmentAPI / embedded backends keep no fork lineage","typeGuard":null,"tryCatchPattern":"try:\n    count = collection.fork_count()\nexcept NotImplementedError:\n    count = 0  # embedded mode: forks not supported","preventionTips":["Report fork counts only from HttpClient deployments","Record fork relationships in collection metadata when lineage matters embedded","Backend-check once at startup instead of try/except at every reporting call"],"tags":["chroma","embedded-mode","segment-api","fork-count","not-implemented"],"backgroundTag":"feature-unsupported-in-embedded-mode","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}