bytedance/deer-flow · error · MemoryStorageCorruption

Fact migration conflict for {candidate['id']!r}

Error message

Fact migration conflict for {candidate['id']!r}

What it means

Error "Fact migration conflict for {candidate['id']!r}" thrown in bytedance/deer-flow.

Source

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

        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)
        _, notifications = self._commit_changes_locked(
            path,
            user_id=user_id,
            agent_name=DEFAULT_AGENT_BUCKET,
            upserts=upserts,
            deletes=[],
            summaries=None,
            expected_revision=int((current_memory or {}).get("revision") or 0),
        )
        # Delete only the source Markdown files that were parsed above. Never
        # recursively remove this directory: if an unexpected file appears
        # concurrently, the final rmdir simply leaves it in place.
        for fact_path in legacy_facts_dir.glob("**/*.md"):
            fact_path.unlink(missing_ok=True)

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Resolve the conflicting existing fact (delete or update it) before re-running migration.
  2. Inspect both versions and merge their content manually if needed.

When it happens

Trigger: Thrown at backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py:576 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/f30cd57bba21bd36. Report an issue: GitHub.