bytedance/deer-flow · error · NotImplementedError

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

Error message

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

What it means

MemoryManager.import_memory raises NotImplementedError by design: the base class in deerflow/agents/memory/manager.py treats importing a memory document into the backend's bucket as an optional capability, and only backends that persist a self-contained local memory document (the default DeerMem file backend) override it. Remote or no-op backends (noop, mem0, honcho, openviking adapters) inherit the raising default because they either keep no importable document or cannot accept one through their API. Hitting it means the configured memory backend simply does not implement document import.

Source

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

        """Clear the bucket's memory; return the cleared (now-empty) document.

        ``agent_name=None`` means all memory owned by the user. An explicit
        agent name clears only that agent's memory and must preserve shared
        user-level summaries. Default: unsupported (raise
        ``NotImplementedError``); backends that support clearing override.
        """
        raise NotImplementedError(f"clear_memory not supported by {type(self).__name__}")

    def import_memory(
        self,
        memory_data: dict[str, Any],
        *,
        user_id: str | None = None,
        agent_name: str | None = None,
    ) -> dict[str, Any]:
        """Import a memory document into the bucket; return the merged result.
        Default: unsupported."""
        raise NotImplementedError(f"import_memory not supported by {type(self).__name__}")

    def export_memory(
        self,
        *,
        user_id: str | None = None,
        agent_name: str | None = None,
    ) -> dict[str, Any]:
        """Export the memory document for the bucket. Default: unsupported (dead
        contract -- zero callers; /memory/export routes via get_memory)."""
        raise NotImplementedError(f"export_memory not supported by {type(self).__name__}")

    def shutdown_flush(self, timeout: float) -> bool:
        """Best-effort bounded drain of pending updates on graceful shutdown.

        Runs on the Gateway shutdown path (after IM channels and the scheduler
        stop, so no new IM/scheduler updates arrive during the drain) to flush
        updates still sitting in the backend's debounce buffer. Without it, any
        update enqueued since the last timer fire is lost on restart / rolling

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Switch memory.manager_class back to a backend that implements import (set memory.manager_class: deermem in config.yaml) and retry the import.
  2. If you must keep the current backend, guard the call with hasattr/try and skip or transform the import (e.g. re-create facts individually via a backend-supported write path).
  3. If you own the backend, override import_memory on your MemoryManager subclass to merge the document into your store.
  4. Check the backend's package under deerflow/agents/memory/backends/<name>/ to confirm which manager methods it overrides before building import tooling.

Example fix

# before
manager = MemoryManager.from_config(cfg)
result = manager.import_memory(doc, user_id="u1")  # NotImplementedError on noop/mem0/honcho

# after
if type(manager).import_memory is MemoryManager.import_memory:
    raise RuntimeError(f"backend {type(manager).__name__} cannot import memory")
result = manager.import_memory(doc, user_id="u1")
Defensive patterns

Strategy: type-guard

Validate before calling

from deerflow.agents.memory.manager import MemoryManager

def supports_import(manager: MemoryManager) -> bool:
    return type(manager).import_memory is not MemoryManager.import_memory

Type guard

def supports_import(manager: MemoryManager) -> bool:
    """True when the backend overrides import_memory (i.e. supports it)."""
    return type(manager).import_memory is not MemoryManager.import_memory

Try / catch

try:
    result = manager.import_memory(doc, user_id=uid)
except NotImplementedError as e:
    # capability mismatch, not a transient failure: report, do not retry
    raise UnsupportedMemoryOperation(str(e)) from e

Prevention

When it happens

Trigger: Calling MemoryManager.import_memory(memory_data, user_id=..., agent_name=...) — directly in Python, or through any code path (API route, script, test) that forwards an import payload — while memory.manager_class resolves to a backend whose class does not override import_memory (e.g. 'noop', 'mem0', 'honcho', 'openviking'). DeerMem overrides it, so the error never fires on the default configuration.

Common situations: Switching config.yaml memory.manager_class from deermem to a remote backend (honcho/mem0/openviking) and then replaying an export/import workflow that worked before; running a migration or backup-restore script that unconditionally calls import_memory; unit tests written against DeerMem being pointed at the noop backend.

Related errors


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