{"record":{"id":"666df915d57bcf4c","repo":"chroma-core/chroma","slug":"conditional-transactions-are-only-supported-when-c-666df9","errorCode":null,"errorMessage":"Conditional transactions are only supported when connecting to a Chroma server via HttpClient. The Rust bindings (embedded mode) do not support conditional transaction operations.","messagePattern":"Conditional transactions are only supported when connecting to a Chroma server via HttpClient\\. The Rust bindings \\(embedded mode\\) do not support conditional transaction operations\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"chromadb/api/rust.py","lineNumber":646,"sourceCode":"            tenant,\n            database,\n        )\n\n        self.product_telemetry_client.capture(\n            CollectionDeleteEvent(\n                collection_uuid=str(collection_id),\n                delete_amount=deleted,\n            )\n        )\n\n        return DeleteResult(deleted=deleted)\n\n    @override\n    def _begin_conditional_transaction(self) -> object:\n        self._unsupported_conditional_transactions()\n\n    def _unsupported_conditional_transactions(self) -> NoReturn:\n        raise NotImplementedError(\n            \"Conditional transactions are only supported when connecting \"\n            \"to a Chroma server via HttpClient. The Rust bindings \"\n            \"(embedded mode) do not support conditional transaction operations.\"\n        )\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,\n        tenant: str = DEFAULT_TENANT,\n        database: str = DEFAULT_DATABASE,","sourceCodeStart":628,"sourceCodeEnd":664,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/rust.py#L628-L664","documentation":"RustBindingsAPI._begin_conditional_transaction (chromadb/api/rust.py:646) delegates to _unsupported_conditional_transactions(), which raises NotImplementedError with this message. Conditional (optimistic, snapshot-isolated) transactions are a Chroma-server feature; acquiring a ConditionalCollectionTransaction in embedded Rust mode fails immediately because the Rust bindings implement none of the _conditional_* operations.","triggerScenarios":"With a Rust bindings client (chromadb.RustClient or chroma_api_impl='chromadb.api.rust.RustBindingsAPI'), merely accessing collection.transaction - the ConditionalCollectionTransaction constructor calls _begin_conditional_transaction (chromadb/api/models/ConditionalCollectionTransaction.py:57) - or calling any txn.get/add/upsert/delete/run on it.","commonSituations":"Writing concurrency-safe read-modify-write code against a Chroma server and then running unit tests with an embedded Rust client; library code shared between server and embedded deployments that assumes transactions exist everywhere.","solutions":["Use chromadb.HttpClient against a Chroma server for conditional transactions","In embedded mode, use plain collection operations (get/query then upsert) - a single embedded process has no cross-client races, so optimistic transactions are unnecessary","Add a lock or serialize access in your own code when you need read-modify-write atomicity embedded"],"exampleFix":"# before (raises NotImplementedError on Rust bindings)\ntxn = collection.transaction\ntxn.run(lambda t: t.add(ids=['a'], embeddings=[[0.1]]))\n\n# after - server client for transactional semantics\nclient = chromadb.HttpClient(host='localhost', port=8000)\ntxn = client.get_collection('docs').transaction\ntxn.run(lambda t: t.add(ids=['a'], embeddings=[[0.1]]))","handlingStrategy":"fallback","validationCode":"def supports_conditional_transactions(client) -> bool:\n    \"\"\"Conditional transactions exist only on HttpClient.\"\"\"\n    return type(client._server).__module__.startswith('chromadb.api.fastapi')","typeGuard":null,"tryCatchPattern":"try:\n    txn = collection.transaction\nexcept NotImplementedError:\n    # embedded: no optimistic transactions; serialize access yourself\n    txn = None\nif txn is None:\n    existing = collection.get(ids=['a'])\n    collection.upsert(ids=['a'], embeddings=[[0.1]])\nelse:\n    txn.run(lambda t: t.upsert(ids=['a'], embeddings=[[0.1]]))","preventionTips":["Acquire collection.transaction only when connected to a Chroma server","In single-process embedded mode, guard read-modify-write cycles with a local lock instead of transactions","Factor transactional code into a strategy that has server and embedded implementations"],"tags":["chroma","embedded-mode","rust-bindings","transaction","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"}