mem0ai/mem0 · error · ValueError
Query text is required for Delta Sync Index with model endpo
Error message
Query text is required for Delta Sync Index with model endpoint.
What it means
ValueError raised in Databricks search when the store is a DELTA_SYNC index with an embedding_model_endpoint_name configured (so Databricks does the embedding server-side) but the caller passed an empty/None query string. The endpoint needs the raw text to embed; without it the query cannot be formed, and vectors are NOT accepted as an alternative in this branch.
Source
Thrown at mem0/vector_stores/databricks.py:494
try:
filters_json = json.dumps(filters) if filters else None
# Choose query mode per Databricks SDK contract:
# - query_text: for Delta Sync Index with model endpoint
# - query_vector: for Direct Access Index and Delta Sync Index with self-managed vectors
query_kwargs = {
"index_name": self.fully_qualified_index_name,
"columns": self.column_names,
"num_results": top_k,
"query_type": self.query_type,
"filters_json": filters_json,
}
uses_model_endpoint = (
self.index_type == VectorIndexType.DELTA_SYNC and self.embedding_model_endpoint_name
)
if uses_model_endpoint:
if not query:
raise ValueError("Query text is required for Delta Sync Index with model endpoint.")
query_kwargs["query_text"] = query
elif vectors:
query_kwargs["query_vector"] = vectors
else:
raise ValueError("Must provide vectors for search.")
sdk_results = self.client.vector_search_indexes.query_index(**query_kwargs)
# Parse results
result_data = sdk_results.result if hasattr(sdk_results, "result") else sdk_results
data_array = result_data.data_array if getattr(result_data, "data_array", None) else []
memory_results = []
for row in data_array:
# Map columns to values
row_dict = dict(zip(self.column_names, row)) if isinstance(row, (list, tuple)) else row
score = row_dict.get("score") or (
row[-1] if isinstance(row, (list, tuple)) and len(row) > len(self.column_names) else NoneView on GitHub (pinned to 001c235229)
Solutions
- Pass a non-empty query string; with a model endpoint the text is embedded by Databricks, so it is mandatory.
- Validate/reject empty queries in your own layer before calling search.
- If you want to search by precomputed vectors instead, remove embedding_model_endpoint_name (use DIRECT_ACCESS semantics) so the vectors branch is taken.
Example fix
# before store.search(query="", vectors=emb, top_k=5) # ValueError on DELTA_SYNC+endpoint # after store.search(query=user_text, top_k=5) # endpoint embeds the text
Defensive patterns
Strategy: validation
Validate before calling
def require_query_text(query: str) -> str:
if not isinstance(query, str) or not query.strip():
raise ValueError("non-empty query text is required for model-endpoint search")
return query
results = store.search(query=require_query_text(user_query), top_k=5) Type guard
def has_nonempty_query(q) -> bool:
return isinstance(q, str) and len(q.strip()) > 0 Prevention
- Reject empty search strings at the API/service layer with a user-friendly message.
- Encapsulate store.search in one repository method that knows whether the store expects text or vectors.
- Document which embedding mode (endpoint vs client) your store was built with.
When it happens
Trigger: Calling search(query='', vectors=[...], top_k=...) or search(query=None, ...) on a DELTA_SYNC + model-endpoint setup. The check uses truthiness, so even whitespace-only handling matters only insofar as '' and None are falsy.
Common situations: Pipeline code written for a DIRECT_ACCESS store passing only vectors; user-supplied empty search strings not filtered upstream; search invoked programmatically with a default query=None.
Related errors
- Must provide vectors for search.
- threshold must be a valid number
- Invalid threshold: ${threshold}. Must be between 0 and 1 (in
- topK must be a valid integer
- Invalid topK: ${topK}. Must be a non-negative integer.
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/c51807087b67b193.
Report an issue: GitHub.