{"record":{"id":"610ea9352cd04235","repo":"chroma-core/chroma","slug":"conditional-transactions-are-not-supported-by-segm","errorCode":null,"errorMessage":"Conditional transactions are not supported by SegmentAPI","messagePattern":"Conditional transactions are not supported by SegmentAPI","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"chromadb/api/segment.py","lineNumber":834,"sourceCode":"\n        records_to_submit = list(\n            _records(operation=t.Operation.DELETE, ids=ids_to_delete)\n        )\n        self._validate_embedding_record_set(scan.collection, records_to_submit)\n        self._producer.submit_embeddings(collection_id, records_to_submit)\n\n        deleted_count = len(ids_to_delete)\n\n        self._product_telemetry_client.capture(\n            CollectionDeleteEvent(\n                collection_uuid=str(collection_id), delete_amount=deleted_count\n            )\n        )\n\n        return DeleteResult(deleted=deleted_count)\n\n    def _unsupported_conditional_transactions(self) -> NoReturn:\n        raise NotImplementedError(\n            \"Conditional transactions are not supported by SegmentAPI\"\n        )\n\n    @override\n    def _begin_conditional_transaction(self) -> object:\n        self._unsupported_conditional_transactions()\n\n    @override\n    def _conditional_get(\n        self,\n        transaction: object,\n        collection_id: UUID,\n        ids: Optional[IDs] = None,\n        where: Optional[Where] = None,\n        limit: Optional[int] = None,\n        offset: Optional[int] = None,\n        where_document: Optional[WhereDocument] = None,\n        include: Include = IncludeMetadataDocuments,","sourceCodeStart":816,"sourceCodeEnd":852,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/segment.py#L816-L852","documentation":"Conditional (compare-and-set style) collection transactions — entered via collection.transaction(), which calls _begin_conditional_transaction — are not supported by the embedded SegmentAPI backend. Every entry point (_begin_conditional_transaction, _conditional_get, and siblings) funnels through _unsupported_conditional_transactions, which raises NotImplementedError; the machinery lives on a Chroma server.","triggerScenarios":"Calling collection.transaction() (opening a ConditionalCollectionTransaction) or any _begin_conditional_transaction/_conditional_get/_conditional_* method on an embedded client (chromadb.Client, EphemeralClient, PersistentClient).","commonSituations":"Transactional read-modify-write code written against a Chroma server is reused in embedded CI runs or notebooks; examples copied from server documentation run against PersistentClient.","solutions":["Use chromadb.HttpClient against a Chroma server for transactional workflows","When embedded, replace the transaction with a plain get -> modify -> add/upsert and accept the race","Feature-detect: wrap collection.transaction() in try/except NotImplementedError and branch"],"exampleFix":"// before\nwith coll.transaction() as tx:  # NotImplementedError embedded\n    rec = tx.get(ids=[rid])\n\n// after\ntry:\n    with coll.transaction() as tx:\n        rec = tx.get(ids=[rid])\nexcept NotImplementedError:\n    rec = coll.get(ids=[rid])  # non-transactional fallback","handlingStrategy":"try-catch","validationCode":"import chromadb\n\ndef supports_transactions(client: chromadb.ClientAPI) -> bool:\n    impl = client.get_settings().chroma_api_impl\n    return impl not in ('chromadb.api.segment.SegmentAPI', 'chromadb.api.rust.RustBindingsAPI')","typeGuard":null,"tryCatchPattern":"try:\n    with coll.transaction() as tx:\n        rec = tx.get(ids=[rid])\n        # ... modify and write via tx\nexcept NotImplementedError:\n    # embedded fallback: non-transactional read-modify-write\n    rec = coll.get(ids=[rid])","preventionTips":["Reserve collection.transaction() for server-backed deployments","Isolate transactional code paths behind an interface so an embedded fallback is pluggable","Mark embedded test suites as skipping transaction tests"],"tags":["chroma","transactions","not-implemented","embedded","segment-api"],"backgroundTag":"feature-requires-server-client","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}