Skip to content

[bug] Search API only uses memory_types[0], silently ignoring all other types #78

@wucm667

Description

@wucm667

What broke?

The search API accepts a list of memory_types, but the retrieval logic only uses memory_types[0]. All other types in the list are silently ignored — they are never searched and no results are returned for them.

Additionally, if the first type happens to be one that the search backend doesn't support (e.g., profile, which is stored in MongoDB and only retrievable via the fetch API), the entire search errors out and returns 0 results.

Steps to Reproduce

Case 1 — silent data loss (no error, but incomplete results):

  1. Start EverMemOS
  2. Send: GET /api/v1/memories/search?memory_types=episodic_memory,foresight&query=hello&retrieve_method=hybrid&top_k=5&user_id=test_user&group_id=test_user
  3. Only episodic_memory is searched. foresight is silently ignored — no warning, no error, no results.

Case 2 — error when unsupported type is first:

  1. Send: GET /api/v1/memories/search?memory_types=profile,episodic_memory,foresight&query=hello&retrieve_method=hybrid&top_k=5&user_id=test_user&group_id=test_user
  2. profile (not indexed in ES/Milvus) is taken as memory_types[0] → ERROR. episodic_memory and foresight are never searched. 0 results returned.

What did you expect?

  • The search should iterate over all requested memory_types
  • For each type supported by ES/Milvus (episodic_memory, foresight, event_log), perform keyword + vector search
  • Skip types not supported by the search backend (e.g., profile) with an info log
  • Merge, deduplicate, and rerank the combined results across all types

What happened instead?

All retrieval methods (get_keyword_search_results, get_vector_search_results, _search_hybrid, _search_rrf, retrieve_mem_agentic, _to_response) hardcode memory_types[0]:

# memory_manager.py line 378 (keyword search)
mem_type = memory_types[0]

# memory_manager.py line 501 (vector search)
mem_type = retrieve_mem_request.memory_types[0]

The rest of the list is never read.

When the first type is profile (not in ES_REPO_MAP or Milvus match):

WARNING - memory_manager.py:382 - Unsupported memory_type: MemoryType.PROFILE
ERROR   - memory_manager.py:619 - Error in get_vector_search_results: Unsupported memory type: MemoryType.PROFILE
ERROR   - memory_manager.py:660 - Error in retrieve_mem_hybrid: Unsupported memory type: MemoryType.PROFILE

Note: profile is a fully implemented memory type — it's stored in MongoDB and retrievable via the fetch API (GET /api/v1/memories/fetch). It's only unsupported in the search path (ES/Milvus), which is expected by design.

Environment (quick)

  • OS: Linux (Docker)
  • Python version: 3.12
  • Install method: Docker

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions