{"record":{"id":"30de2ab0407473f0","repo":"MemPalace/mempalace","slug":"query-requires-exactly-one-of-query-texts-or-query","errorCode":null,"errorMessage":"query requires exactly one of query_texts or query_embeddings","messagePattern":"query requires exactly one of query_texts or query_embeddings","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mempalace/backends/chroma.py","lineNumber":1744,"sourceCode":"    # ------------------------------------------------------------------\n    # Reads\n    # ------------------------------------------------------------------\n\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,","sourceCodeStart":1726,"sourceCodeEnd":1762,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/backends/chroma.py#L1726-L1762","documentation":"A SearchError raised during memory search: the palace path given is not a directory on disk, so no palace can exist there. It is the sibling of 'No palace database at {path}', which fires when the directory exists but has no chroma database — this variant means the directory itself is missing.","triggerScenarios":"Calling search (search_memories / the search CLI/MCP tool) with a palace_path that does not exist or is a typo; os.path.isdir(palace_path) is False after _open_collection_or_explain returned None.","commonSituations":"Wrong --palace argument or MEMPALACE_PALACE_PATH env value; palace stored on an unmounted drive; running from a different machine/home without the palace.","solutions":["Verify the path: ls the parent directory and confirm the palace folder name spelling.","Point the search at the correct palace directory (check your config/env for the palace root).","If the palace was never created, run init + mine first."],"exampleFix":"import os\nif not os.path.isdir(palace_path):\n    raise SystemExit(f'bad palace path: {palace_path}')\nsearch_memories(query, palace_path=palace_path)","handlingStrategy":"validation","validationCode":"import os\nif not os.path.isdir(palace_path):\n    raise SystemExit(f'no palace directory at {palace_path}')\nif not os.path.isfile(os.path.join(palace_path, 'chroma.sqlite3')):\n    raise SystemExit(f'palace at {palace_path} has no chroma database')","typeGuard":"def is_usable_palace(path: str) -> bool:\n    return os.path.isdir(path) and os.path.isfile(os.path.join(path, 'chroma.sqlite3'))","tryCatchPattern":"try:\n    search_memories(query, palace_path=palace_path)\nexcept SearchError as e:\n    if str(e).startswith('No palace found'):\n        fix_palace_path_config()","preventionTips":["Centralize the palace path in config/env and validate it at startup.","Use absolute paths for the palace directory in scripts and hooks."],"tags":["search","path","file-not-found","config"],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}