{"record":{"id":"62bfce56d1c27fe9","repo":"chroma-core/chroma","slug":"batch-size-len-batch-0-exceeds-maximum-batch-s","errorCode":null,"errorMessage":"Batch size {len(batch[0])} exceeds maximum batch size {limits['max_batch_size']}","messagePattern":"Batch size (.+?) exceeds maximum batch size (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/api/types.py","lineNumber":1482,"sourceCode":"            f\"Expected images to be a non-empty list, got {len(images)} images\"\n        )\n    for image in images:\n        if not is_image(image):\n            raise ValueError(f\"Expected image to be a numpy array, got {image}\")\n\n\ndef validate_batch(\n    batch: Tuple[\n        IDs,\n        Optional[Union[Embeddings, PyEmbeddings]],\n        Optional[Metadatas],\n        Optional[Documents],\n        Optional[URIs],\n    ],\n    limits: Dict[str, Any],\n) -> None:\n    if len(batch[0]) > limits[\"max_batch_size\"]:\n        raise ValueError(\n            f\"Batch size {len(batch[0])} exceeds maximum batch size {limits['max_batch_size']}\"\n        )\n\n\ndef convert_np_embeddings_to_list(embeddings: Embeddings) -> PyEmbeddings:\n    # Cast the result to PyEmbeddings to ensure type compatibility\n    return cast(PyEmbeddings, [embedding.tolist() for embedding in embeddings])\n\n\ndef convert_list_embeddings_to_np(embeddings: PyEmbeddings) -> Embeddings:\n    return [np.array(embedding) for embedding in embeddings]\n\n\n@runtime_checkable\nclass SparseEmbeddingFunction(Protocol[D]):\n    \"\"\"Protocol for sparse embedding functions.\n\n    To implement a new sparse embedding function, you need to implement the following methods:","sourceCodeStart":1464,"sourceCodeEnd":1500,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/types.py#L1464-L1500","documentation":"Error \"Batch size {len(batch[0])} exceeds maximum batch size {limits['max_batch_size']}\" thrown in chroma-core/chroma.","triggerScenarios":"Thrown at chromadb/api/types.py:1482 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}