{"record":{"id":"d19ce5ff86f3c374","repo":"MemPalace/mempalace","slug":"query-input-must-be-a-non-empty-list","errorCode":null,"errorMessage":"query input must be a non-empty list","messagePattern":"query input must be a non-empty list","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mempalace/backends/chroma.py","lineNumber":1747,"sourceCode":"\n    def query(\n        self,\n        *,\n        query_texts=None,\n        query_embeddings=None,\n        n_results=10,\n        where=None,\n        where_document=None,\n        include=None,\n    ) -> QueryResult:\n        _validate_where(where)\n        _validate_where(where_document)\n\n        if (query_texts is None) == (query_embeddings is None):\n            raise ValueError(\"query requires exactly one of query_texts or query_embeddings\")\n        chosen = query_texts if query_texts is not None else query_embeddings\n        if not chosen:\n            raise ValueError(\"query input must be a non-empty list\")\n\n        spec = _IncludeSpec.resolve(include, default_distances=True)\n        chroma_include: list[str] = []\n        if spec.documents:\n            chroma_include.append(\"documents\")\n        if spec.metadatas:\n            chroma_include.append(\"metadatas\")\n        if spec.distances:\n            chroma_include.append(\"distances\")\n        if spec.embeddings:\n            chroma_include.append(\"embeddings\")\n\n        kwargs: dict[str, Any] = {\n            \"n_results\": n_results,\n            \"include\": chroma_include,\n        }\n        if query_texts is not None:\n            kwargs[\"query_texts\"] = query_texts","sourceCodeStart":1729,"sourceCodeEnd":1765,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/backends/chroma.py#L1729-L1765","documentation":"A SearchError raised when the underlying chromadb collection.query() call throws: the raw exception is printed and re-wrapped so callers only ever need to handle SearchError, with the original chained via `from e`. The root cause is whatever chromadb raised — bad where-filter, dimension mismatch, corrupted index, connection issues.","triggerScenarios":"col.query(query_texts=[...], n_results=..., include=[...]) raising inside the try block — e.g. embedding-model dimension drift between palace creation and search, malformed where filter, or a corrupted HNSW index.","commonSituations":"Querying a palace built with a different embedding function/model; legacy palaces missing hnsw:space=cosine; chromadb internal errors after partial corruption.","solutions":["Read the inner {e} text — it names the actual chromadb failure.","If it mentions dimension/embedding mismatch, re-mine or repair the palace with the current embedding setup.","If it mentions the metric/space, run the palace repair to set hnsw:space=cosine.","Re-run with a simpler query (no wing/room filter) to isolate whether the where-filter is the trigger."],"exampleFix":"try:\n    results = search_memories('query', palace_path=palace)\nexcept SearchError as e:\n    log.warning('search failed: %s', e)\n    results = []  # degrade gracefully at the call site","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    results = search_memories(query, palace_path=palace_path)\nexcept SearchError:\n    results = []  # memory is an augmentation; degrade, don't crash the host app","preventionTips":["Keep the embedding model consistent between mining and searching.","Run the legacy-metric repair when warned about hnsw:space.","Always catch SearchError at the application boundary; it wraps every underlying chromadb failure."],"tags":["search","chromadb","wrapper","embedding"],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}