{"record":{"id":"bcf3d00c17779963","repo":"chroma-core/chroma","slug":"ids-must-be-provided-for-transactional-delete-bcf3d0","errorCode":null,"errorMessage":"ids must be provided for transactional delete","messagePattern":"ids must be provided for transactional delete","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/api/models/ConditionalCollectionTransaction.py","lineNumber":260,"sourceCode":"            lambda: self._collection._client._conditional_upsert(\n                transaction=self._transaction,\n                collection_id=self._collection.id,\n                ids=upsert_request[\"ids\"],\n                embeddings=upsert_request[\"embeddings\"],\n                metadatas=upsert_request[\"metadatas\"],\n                documents=upsert_request[\"documents\"],\n                uris=upsert_request[\"uris\"],\n                tenant=self._collection.tenant,\n                database=self._collection.database,\n            )\n        )\n\n    def delete(self, ids: OneOrMany[ID]) -> None:\n        delete_request = self._collection._validate_and_prepare_delete_request(\n            ids, None, None\n        )\n        if delete_request[\"ids\"] is None:\n            raise ValueError(\"ids must be provided for transactional delete\")\n\n        self._run_transaction_operation(\n            lambda: self._collection._client._conditional_delete(\n                transaction=self._transaction,\n                collection_id=self._collection.id,\n                ids=delete_request[\"ids\"],\n                tenant=self._collection.tenant,\n                database=self._collection.database,\n            )\n        )\n\n    def commit(self) -> ConditionalCommitResult:\n        if self._commit_blocked_by_run:\n            raise ValueError(\"txn.commit() cannot be called inside run()\")\n        return self._commit_after_run()\n","sourceCodeStart":242,"sourceCodeEnd":276,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/models/ConditionalCollectionTransaction.py#L242-L276","documentation":"Synchronous twin of the async error: ConditionalCollectionTransaction.delete() only supports delete-by-ID. The request is built with where/where_document forced to None; if the validated ids come back None, the buffered-write transaction cannot proceed and raises before contacting the server.","triggerScenarios":"Calling `txn.delete(ids)` inside `collection.transaction.run(...)` on a sync Collection with an ids value that passes the presence check but unpacks to None (None-equivalent/empty/malformed value).","commonSituations":"Moving filter-based deletes into optimistic transactions; passing a variable that is None at runtime inside the run callback.","solutions":["Pass an explicit list of IDs: `txn.delete([\"id-1\", \"id-2\"])`","Collect IDs first with `txn.get(where=..., include=[])` and delete those in the same transaction","Use non-transactional `collection.delete(where=...)` when predicate deletes are required"],"exampleFix":"# before\ntxn.delete(ids=None)\n\n# after\nif not ids:\n    raise ValueError(\"transactional delete requires ids\")\ntxn.delete(ids=ids)","handlingStrategy":"validation","validationCode":"ids = list(ids or [])\nif not ids:\n    raise ValueError(\"transactional delete requires explicit non-empty ids\")\ntxn.delete(ids=ids)","typeGuard":"from typing import Any, List, TypeGuard\n\ndef is_non_empty_id_list(v: Any) -> TypeGuard[List[str]]:\n    return isinstance(v, (list, tuple)) and len(v) > 0 and all(isinstance(i, str) for i in v)","tryCatchPattern":null,"preventionTips":["Transactions are delete-by-id only; resolve filters to ids with txn.get() first","Assert ids non-empty immediately before txn.delete inside the callback","Fall back to collection.delete(where=...) when predicate deletes are required"],"tags":["transactions","delete","input-validation"],"backgroundTag":"missing-required-parameter","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}