infiniflow/ragflow · error · NotFoundException

404

404

Error message

Memory '{memory_id}' not found.

What it means

Error "Memory '{memory_id}' not found." thrown in infiniflow/ragflow.

Source

Thrown at api/apps/services/memory_api_service.py:297

        filter_dict["tenant_id"] = [tenant_id for tenant_id in tenant_ids if tenant_id in allowed_tenant_ids]
        if not filter_dict["tenant_id"]:
            return {"memory_list": [], "total_count": 0}
    else:
        filter_dict["tenant_id"] = list(allowed_tenant_ids)
    memory_types = _split_filter_values(filter_params.get("memory_type"))
    filter_dict["memory_type"] = memory_types

    memory_list, count = MemoryService.get_by_filter(filter_dict, keywords, page, page_size)
    embd_name_map = get_composite_model_name_by_ids([memory["embd_id"] for memory in memory_list])
    [memory.update({"memory_type": get_memory_type_human(memory["memory_type"]), "embd_name": embd_name_map.get(memory["embd_id"], "")}) for memory in memory_list]
    memory_list.sort(key=lambda m: m["create_time"], reverse=True)
    return {"memory_list": memory_list, "total_count": count}


async def get_memory_config(memory_id):
    memory = MemoryService.get_with_owner_name_by_id(memory_id)
    if not memory or not _memory_accessible(memory):
        raise NotFoundException(f"Memory '{memory_id}' not found.")
    return format_ret_data_from_memory(memory)


async def get_memory_messages(memory_id, agent_ids: list[str], keywords: str, page: int = 1, page_size: int = 50):
    memory = _require_memory_access(memory_id)
    messages = MessageService.list_message(memory.tenant_id, memory_id, agent_ids, keywords, page, page_size)
    agent_name_mapping = {}
    extract_task_mapping = {}
    if messages["message_list"]:
        agent_list = UserCanvasService.get_basic_info_by_canvas_ids([message["agent_id"] for message in messages["message_list"]])
        agent_name_mapping = {agent["id"]: agent["title"] for agent in agent_list}
        task_list = TaskService.get_tasks_progress_by_doc_ids([memory_id])
        if task_list:
            task_list.sort(key=lambda t: t["create_time"])  # asc, use newer when exist more than one task
            for task in task_list:
                # the 'digest' field carries the source_id when a task is created, so use 'digest' as key
                extract_task_mapping.update({int(task["digest"]): task})
    for message in messages["message_list"]:

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Verify the memory_id exists before the operation.
  2. List memories and use a valid id; the record may have been deleted.

Example fix

mem = MemoryService.get_by_id(memory_id)
if not mem:
    raise ValueError(f"Memory '{memory_id}' not found.")

When it happens

Trigger: Thrown at api/apps/services/memory_api_service.py:297 when the library encounters an invalid state.

Common situations: The request references a memory id that does not exist or was deleted; confirming the id beforehand prevents this error.


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/b8a1903b819ecfeb. Report an issue: GitHub.