RyanCodrai/turbovec · error · ValueError
Please provide a list of Documents.
Error message
Please provide a list of Documents.
What it means
Raised in TurboQuantDocumentStore.write_documents when the input is not an iterable of haystack Document objects (e.g. a plain string, a single Document, or a list containing non-Document items). It mirrors InMemoryDocumentStore's input-shape validation, failing fast before any lock or mutation instead of an AttributeError on .embedding.
Source
Thrown at turbovec-python/python/turbovec/haystack.py:233
else:
docs = [self._reconstruct(data) for data in list(self._u64_to_doc.values())]
# `return_embedding` is informational here — we never have the
# full-precision embedding to begin with. Kept for parity.
return docs
def write_documents(
self,
documents: List[Document],
policy: DuplicatePolicy = DuplicatePolicy.NONE,
) -> int:
# Match InMemoryDocumentStore's input-shape validation rather
# than letting a bad input AttributeError on `.embedding`.
if (
not isinstance(documents, Iterable)
or isinstance(documents, str)
or any(not isinstance(doc, Document) for doc in documents)
):
raise ValueError("Please provide a list of Documents.")
if policy == DuplicatePolicy.NONE:
policy = DuplicatePolicy.FAIL
with self._write_lock:
return self._write_documents_locked(documents, policy)
def _write_documents_locked(
self, documents: List[Document], policy: DuplicatePolicy
) -> int:
if policy == DuplicatePolicy.FAIL:
# Reference parity (issue #167): InMemoryDocumentStore commits
# each document as it iterates and raises on the *first*
# duplicate, so every non-duplicate document preceding it
# stays persisted — a partial write. Mirror that observable
# state exactly: validate and commit per document, raising on
# the first collision. A repeated id within a single call
# collides with its already-committed first instance, the sameView on GitHub (pinned to ccab9f325e)
Solutions
- Pass a list of haystack Document instances, e.g. [Document(content=..., embedding=...)].
- Validate the caller's pipeline output — upstream components may yield raw strings or dicts instead of Documents.
- Catch the ValueError in ingestion code to give a clearer 'wrong input type' message.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at turbovec-python/python/turbovec/haystack.py:233 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of RyanCodrai/turbovec@ccab9f325e (2026-09-06).
Data as JSON: /api/errors/6b4388dd38ed9a53.
Report an issue: GitHub.