{"record":{"id":"e01a85b081a501dc","repo":"chroma-core/chroma","slug":"expected-document-to-be-a-str-got-document","errorCode":null,"errorMessage":"Expected document to be a str, got {document}","messagePattern":"Expected document to be a str, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/api/types.py","lineNumber":1455,"sourceCode":"    return vectors\n\n\ndef validate_documents(documents: Documents, nullable: bool = False) -> None:\n    \"\"\"Validates documents to ensure it is a list of strings\"\"\"\n    if not isinstance(documents, list):\n        raise ValueError(\n            f\"Expected documents to be a list, got {type(documents).__name__}\"\n        )\n    if len(documents) == 0:\n        raise ValueError(\n            f\"Expected documents to be a non-empty list, got {len(documents)} documents\"\n        )\n    for document in documents:\n        # If embeddings are present, some documents can be None\n        if document is None and nullable:\n            continue\n        if not is_document(document):\n            raise ValueError(f\"Expected document to be a str, got {document}\")\n\n\ndef validate_images(images: Images) -> None:\n    \"\"\"Validates images to ensure it is a list of numpy arrays\"\"\"\n    if not isinstance(images, list):\n        raise ValueError(f\"Expected images to be a list, got {type(images).__name__}\")\n    if len(images) == 0:\n        raise ValueError(\n            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,","sourceCodeStart":1437,"sourceCodeEnd":1473,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/types.py#L1437-L1473","documentation":"Error \"Expected document to be a str, got {document}\" thrown in chroma-core/chroma.","triggerScenarios":"Thrown at chromadb/api/types.py:1455 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"}