infiniflow/ragflow · error · Exception
No memory is selected.
Error message
No memory is selected.
What it means
The Retrieval component's memory path (_retrieve_memory, agent/tools/retrieval.py:272) collects self._param.memory_ids and calls MemoryService.get_by_ids. If the lookup returns no rows it raises Exception('No memory is selected.'), i.e. the component is configured to search memories but no configured memory ID resolves to an existing record.
Source
Thrown at agent/tools/retrieval.py:272
# Format the chunks for JSON output (similar to how other tools do it)
json_output = kbinfos["chunks"].copy()
self._canvas.add_reference(kbinfos["chunks"], kbinfos["doc_aggs"])
form_cnt = "\n".join(kb_prompt(kbinfos, 200000, True))
# Set both formalized content and JSON output
self.set_output("formalized_content", form_cnt)
self.set_output("json", json_output)
return form_cnt
async def _retrieve_memory(self, query_text: str):
memory_ids: list[str] = [memory_id for memory_id in self._param.memory_ids]
user_id: str = self._param.user_id if hasattr(self._param, "user_id") else None
memory_list = MemoryService.get_by_ids(memory_ids)
if not memory_list:
raise Exception("No memory is selected.")
embd_names = list({memory.embd_id for memory in memory_list})
assert len(embd_names) == 1, "Memory use different embedding models."
vars = self.get_input_elements_from_text(query_text)
vars = {k: o["value"] for k, o in vars.items()}
query = self.string_format(query_text, vars)
# query message
filter_dict: dict = {"memory_id": memory_ids}
if user_id:
import re
# is variable
if re.match(r"^{.*}$", user_id):
user_id = self._canvas.get_variable_value(user_id)
filter_dict["user_id"] = user_id
message_list = memory_message_service.query_message(
filter_dict, {"query": query, "similarity_threshold": self._param.similarity_threshold, "keywords_similarity_weight": self._param.keywords_similarity_weight, "top_n": self._param.top_n}View on GitHub (pinned to 554fb1133a)
Solutions
- Open the Retrieval component config and select at least one existing memory in the memory_ids picker.
- Verify the memory still exists (check the memory/dataset admin page) and re-select it if it was recreated with a new ID.
- If memory search is optional, disable the memory option instead of leaving it on with an empty selection.
- When importing agents from another deployment, rebind memory IDs to local ones.
Example fix
// before "memory_ids": [] // memory search enabled but nothing selected // after "memory_ids": ["mem_9c3d..."]
Defensive patterns
Strategy: validation
Validate before calling
from api.db.services.memory_service import MemoryService
if memory_search_enabled:
if not memory_ids or not MemoryService.get_by_ids(list(memory_ids)):
raise ValueError("Memory search is enabled but no valid memory is selected") Try / catch
try:
await retrieval._retrieve_memory(q)
except Exception as e:
if "No memory is selected" in str(e):
# degrade to plain retrieval instead of failing the whole canvas
return await retrieval._retrieve(q)
raise Prevention
- Disable the memory option instead of leaving memory_ids empty.
- After deleting memories, sweep agents that referenced them.
- Rebind memory IDs when importing agents from other deployments.
When it happens
Trigger: memory_ids is empty on a Retrieval component whose mode/inputs route it into _retrieve_memory; the configured memory records were deleted; memory IDs copied from another tenant/environment that do not exist locally.
Common situations: Agent template references a memory that was removed; user toggles 'use memory' but never picks a memory; importing agent JSON across environments.
Related errors
- No dataset is selected.
- Dataset({nm_or_id}) does not exist.
- SANDBOX_LOCAL_MAX_MEMORY_MB must be greater than 0.
- Invalid response from SearXNG
- Webhook security is required. Set allow_anonymous to true to
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/595415bc5438e17f.
Report an issue: GitHub.