bytedance/deer-flow · error · MemoryStorageCorruption

Cannot migrate previous default bucket {legacy_agent_dir}: u

Error message

Cannot migrate previous default bucket {legacy_agent_dir}: unexpected entries {names}

What it means

Error "Cannot migrate previous default bucket {legacy_agent_dir}: unexpected entries {names}" thrown in bytedance/deer-flow.

Source

Thrown at backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py:562

        user_id: str | None,
    ) -> tuple[bool, list[RetrievalNotification]]:
        """Move facts written by the earlier ``lead-agent`` default mapping.

        A real custom ``lead-agent`` owns a ``config.yaml`` and is never
        touched.  A directory with any other unexpected file is also preserved
        and rejected instead of being guessed at or recursively deleted.
        """
        legacy_agent_name = "lead-agent"
        legacy_agent_dir = path.parent / "agents" / legacy_agent_name
        if not legacy_agent_dir.exists() or (legacy_agent_dir / "config.yaml").is_file():
            return False, []
        unexpected = [child for child in legacy_agent_dir.iterdir() if child.name != "facts"]
        legacy_facts_dir = legacy_agent_dir / "facts"
        if legacy_facts_dir.exists():
            unexpected.extend(child for child in legacy_facts_dir.glob("**/*") if child.is_file() and child.suffix.lower() != ".md")
        if unexpected:
            names = ", ".join(sorted(child.name for child in unexpected))
            raise MemoryStorageCorruption(f"Cannot migrate previous default bucket {legacy_agent_dir}: unexpected entries {names}")

        legacy_facts = self._load_agent_facts(path, legacy_agent_name, user_id=user_id)
        upserts: list[dict[str, Any]] = []
        for legacy_fact in legacy_facts:
            candidate = _normalize_fact(legacy_fact, scope=_scope_dict(user_id, DEFAULT_AGENT_BUCKET))
            existing, _ = self._read_fact(
                path,
                candidate["id"],
                user_id=user_id,
                agent_name=DEFAULT_AGENT_BUCKET,
            )
            if existing is not None:
                if not self._migration_equivalent(candidate, existing):
                    raise MemoryStorageCorruption(f"Fact migration conflict for {candidate['id']!r}")
                continue
            upserts.append(candidate)

        current_memory = self._load_memory_file(path)

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Manually move or remove the unexpected entries listed in the legacy bucket directory, then retry migration.
  2. Inspect the directory; only expected memory files may remain for automatic migration.

When it happens

Trigger: Thrown at backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py:562 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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