{"record":{"id":"8c79df218f8055bd","repo":"chroma-core/chroma","slug":"at-least-one-of-ids-where-or-where-document-must","errorCode":null,"errorMessage":"At least one of ids, where, or where_document must be provided","messagePattern":"At least one of ids, where, or where_document must be provided","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/api/models/CollectionCommon.py","lineNumber":473,"sourceCode":"\n        return UpsertRequest(\n            ids=upsert_records[\"ids\"],\n            metadatas=upsert_metadatas,\n            embeddings=upsert_embeddings,\n            documents=upsert_records[\"documents\"],\n            uris=upsert_records[\"uris\"],\n        )\n\n    @validation_context(\"delete\")\n    def _validate_and_prepare_delete_request(\n        self,\n        ids: Optional[IDs],\n        where: Optional[Where],\n        where_document: Optional[WhereDocument],\n        limit: Optional[int] = None,\n    ) -> DeleteRequest:\n        if ids is None and where is None and where_document is None:\n            raise ValueError(\n                \"At least one of ids, where, or where_document must be provided\"\n            )\n\n        if limit is not None:\n            if not isinstance(limit, int) or isinstance(limit, bool):\n                raise TypeError(\"limit must be a non-negative integer\")\n            if limit < 0:\n                raise ValueError(\"limit must be a non-negative integer\")\n\n        if limit is not None and where is None and where_document is None:\n            raise ValueError(\n                \"limit can only be specified when a where or where_document clause is provided\"\n            )\n\n        # Unpack\n        if ids is not None:\n            request_ids = cast(IDs, maybe_cast_one_to_many(ids))\n        else:","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/models/CollectionCommon.py#L455-L491","documentation":"`_validate_and_prepare_delete_request` requires at least one selector for a delete. Deleting everything implicitly is dangerous and not supported, so `collection.delete()` with ids, where, and where_document all None is rejected.","triggerScenarios":"`collection.delete()` with no arguments, or `collection.delete(ids=None, where=None, where_document=None)` (e.g. all filter variables end up None at runtime).","commonSituations":"Building filters dynamically where every condition is optional and all end up unset; porting code from another vector DB that allows an unfiltered delete-all.","solutions":["Pass at least one selector: ids, where, or where_document","If delete-all is intended, list the IDs first (`collection.get(include=[])`) and delete by ids","Guard the call: only invoke delete when at least one filter is non-None"],"exampleFix":"# before\ncollection.delete(ids=ids, where=where)  # both None\n\n# after\nif ids is None and where is None and where_document is None:\n    raise ValueError(\"refusing to delete without a selector\")\ncollection.delete(ids=ids, where=where, where_document=where_document)","handlingStrategy":"validation","validationCode":"if ids is None and where is None and where_document is None:\n    raise ValueError(\"delete needs at least one of ids/where/where_document\")\ncollection.delete(ids=ids, where=where, where_document=where_document)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build optional-filter objects and skip the delete call entirely when all are unset","Treat delete-all as an explicit ids list obtained from get(), never as a no-filter delete","Add a lint/unit check that no call site invokes delete() with zero selectors"],"tags":["delete","input-validation","where-filter"],"backgroundTag":"missing-required-parameter","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}