MemPalace/mempalace · error · ValueError

query requires exactly one of query_texts or query_embedding

Error message

query requires exactly one of query_texts or query_embeddings

What it means

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.

Source

Thrown at mempalace/backends/chroma.py:1744

    # ------------------------------------------------------------------
    # Reads
    # ------------------------------------------------------------------

    def query(
        self,
        *,
        query_texts=None,
        query_embeddings=None,
        n_results=10,
        where=None,
        where_document=None,
        include=None,
    ) -> QueryResult:
        _validate_where(where)
        _validate_where(where_document)

        if (query_texts is None) == (query_embeddings is None):
            raise ValueError("query requires exactly one of query_texts or query_embeddings")
        chosen = query_texts if query_texts is not None else query_embeddings
        if not chosen:
            raise ValueError("query input must be a non-empty list")

        spec = _IncludeSpec.resolve(include, default_distances=True)
        chroma_include: list[str] = []
        if spec.documents:
            chroma_include.append("documents")
        if spec.metadatas:
            chroma_include.append("metadatas")
        if spec.distances:
            chroma_include.append("distances")
        if spec.embeddings:
            chroma_include.append("embeddings")

        kwargs: dict[str, Any] = {
            "n_results": n_results,
            "include": chroma_include,

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Verify the path: ls the parent directory and confirm the palace folder name spelling.
  2. Point the search at the correct palace directory (check your config/env for the palace root).
  3. If the palace was never created, run init + mine first.

Example fix

import os
if not os.path.isdir(palace_path):
    raise SystemExit(f'bad palace path: {palace_path}')
search_memories(query, palace_path=palace_path)
Defensive patterns

Strategy: validation

Validate before calling

import os
if not os.path.isdir(palace_path):
    raise SystemExit(f'no palace directory at {palace_path}')
if not os.path.isfile(os.path.join(palace_path, 'chroma.sqlite3')):
    raise SystemExit(f'palace at {palace_path} has no chroma database')

Type guard

def is_usable_palace(path: str) -> bool:
    return os.path.isdir(path) and os.path.isfile(os.path.join(path, 'chroma.sqlite3'))

Try / catch

try:
    search_memories(query, palace_path=palace_path)
except SearchError as e:
    if str(e).startswith('No palace found'):
        fix_palace_path_config()

Prevention

When it happens

Trigger: 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.

Common situations: Wrong --palace argument or MEMPALACE_PALACE_PATH env value; palace stored on an unmounted drive; running from a different machine/home without the palace.

Related errors


AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15). Data as JSON: /api/errors/30de2ab0407473f0. Report an issue: GitHub.