bytedance/deer-flow · error · NotImplementedError

get_memory not supported by {type(self).__name__}

Error message

get_memory not supported by {type(self).__name__}

What it means

The base MemoryManager.get_memory() raises NotImplementedError naming the backend class: returning the full memory document is an optional capability that backends must opt into by overriding. The default keeps the contract honest — an unsupported read cannot be mistaken for an empty memory document.

Source

Thrown at backend/packages/harness/deerflow/agents/memory/manager.py:290

        agent_name: str | None = None,
        category: str | None = None,
    ) -> list[dict[str, Any]]:
        """Search the bucket's memory for facts matching ``query``; return up to
        ``top_k`` ranked by relevance. ``category`` (optional) filters BEFORE the
        ``top_k`` slice so a category-scoped search is not starved by other
        categories' higher-ranked facts. Default: unsupported (raise); backends
        with retrieval override AND set ``supports_search = True`` (required for
        ``mode='tool'``)."""
        raise NotImplementedError(f"search not supported by {type(self).__name__}")

    def get_memory(
        self,
        *,
        user_id: str | None = None,
        agent_name: str | None = None,
    ) -> dict[str, Any]:
        """Return the full memory document for the bucket. Default: unsupported."""
        raise NotImplementedError(f"get_memory not supported by {type(self).__name__}")

    def delete_memory(
        self,
        *,
        user_id: str | None = None,
        agent_name: str | None = None,
    ) -> None:
        """Delete the entire memory document for the bucket. Default: unsupported
        (dead contract -- zero callers)."""
        raise NotImplementedError(f"delete_memory not supported by {type(self).__name__}")

    def clear_memory(
        self,
        *,
        user_id: str | None = None,
        agent_name: str | None = None,
    ) -> dict[str, Any]:
        """Clear the bucket's memory; return the cleared (now-empty) document.

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Guard the call with a capability check (hasattr/overridden test against MemoryManager.get_memory) or a backend-specific flag
  2. Use a backend that implements get_memory (e.g. DeerMem file storage) if whole-document reads are required
  3. In custom backends, override get_memory() to return the merged document

Example fix

# before
memory_doc = manager.get_memory(user_id='default')

# after
is_overridden = type(manager).get_memory is not MemoryManager.get_memory
memory_doc = manager.get_memory(user_id='default') if is_overridden else {"user": {}, "history": {}, "facts": []}
Defensive patterns

Strategy: type-guard

Validate before calling

from deerflow.agents.memory.manager import MemoryManager
if type(manager).get_memory is MemoryManager.get_memory:
    return {"supported": False}  # whole-document read unavailable on this backend
return manager.get_memory(user_id=user)

Type guard

def backend_can_get_memory(manager) -> bool:
    from deerflow.agents.memory.manager import MemoryManager
    return type(manager).get_memory is not MemoryManager.get_memory

Try / catch

try:
    doc = manager.get_memory(user_id=user)
except NotImplementedError:
    doc = None  # treat as 'view not supported' rather than empty memory

Prevention

When it happens

Trigger: Calling manager.get_memory(user_id=..., agent_name=...) on a backend that does not override get_memory (the base default). Reachable via programmatic callers such as memory inspection endpoints or custom code; middleware-mode backends without whole-document reads hit it.

Common situations: Settings/UI code or scripts assuming every backend can dump the full memory document; custom backends that implement only add() and injection.

Related errors


AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14). Data as JSON: /api/errors/d9a2126ec915c7b6. Report an issue: GitHub.