{"record":{"id":"2574eaca5d886645","repo":"chroma-core/chroma","slug":"collection-forking-is-not-implemented-for-segmenta","errorCode":null,"errorMessage":"Collection forking is not implemented for SegmentAPI","messagePattern":"Collection forking is not implemented for SegmentAPI","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"chromadb/api/segment.py","lineNumber":453,"sourceCode":"            self._sysdb.update_collection(\n                id, metadata=new_metadata, configuration=new_configuration\n            )\n        elif new_name:\n            self._sysdb.update_collection(id, name=new_name)\n        elif new_metadata:\n            self._sysdb.update_collection(id, metadata=new_metadata)\n        elif new_configuration:\n            self._sysdb.update_collection(id, configuration=new_configuration)\n\n    @override\n    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,","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/segment.py#L435-L471","documentation":"SegmentAPI._fork (chromadb/api/segment.py:453) is an intentional stub. Collection forking is implemented only by the Chroma server; SegmentAPI - the default backend for chromadb.PersistentClient and chromadb.EphemeralClient - cannot fork collections, so Collection.fork() raises NotImplementedError in all embedded modes.","triggerScenarios":"client = chromadb.PersistentClient(path='./data'); client.get_collection('docs').fork('docs-copy') - same for EphemeralClient. Any fork() call that routes to SegmentAPI.","commonSituations":"Local development or notebook prototyping of code written for a Chroma server; test suites on ephemeral clients exercising fork-based snapshot flows.","solutions":["Connect to a Chroma server with chromadb.HttpClient (start one with `chroma run`) and fork there","Emulate the fork embedded: create_collection + copy records via get()/add()","Branch on backend type before calling fork()"],"exampleFix":"# before (raises NotImplementedError on PersistentClient/EphemeralClient)\nclient = chromadb.PersistentClient(path='./data')\nclone = client.get_collection('docs').fork('docs-copy')\n\n# after\nclient = chromadb.HttpClient(host='localhost', port=8000)\nclone = client.get_collection('docs').fork('docs-copy')","handlingStrategy":"fallback","validationCode":"def is_server_client(client) -> bool:\n    \"\"\"fork() exists only on the Chroma server (HttpClient).\"\"\"\n    return type(client._server).__module__.startswith('chromadb.api.fastapi')","typeGuard":null,"tryCatchPattern":"try:\n    clone = collection.fork('docs-copy')\nexcept NotImplementedError:\n    # SegmentAPI (PersistentClient/EphemeralClient): manual copy fallback\n    clone = client.create_collection('docs-copy')\n    data = collection.get(include=['embeddings', 'documents', 'metadatas'])\n    clone.add(ids=data['ids'], embeddings=data['embeddings'],\n              documents=data['documents'], metadatas=data['metadatas'])","preventionTips":["Design fork/snapshot flows for server deployments only","Use PersistentClient/EphemeralClient for local work knowing fork is unavailable","Wrap fork behind an interface with a documented embedded fallback"],"tags":["chroma","embedded-mode","segment-api","fork","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"}