bytedance/deer-flow · error · MemoryStorageCorruption

Legacy fact in {source_path} is not an object

Error message

Legacy fact in {source_path} is not an object

What it means

Error "Legacy fact in {source_path} is not an object" thrown in bytedance/deer-flow.

Source

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

                    canonical=migrated_summaries[section],
                    legacy=legacy_memory.get(section, {}),
                    section=section,
                    legacy_path=legacy_path,
                )

        upserts: list[dict[str, Any]] = []
        pending: dict[str, dict[str, Any]] = {}
        for source_path, source_memory in sources:
            source_document = self._document_from_memory_file(
                source_memory,
                source_path,
                agent_name,
                user_id=user_id,
                allow_legacy_facts=True,
            )
            for raw_fact in source_document.get("facts", []):
                if not isinstance(raw_fact, dict):
                    raise MemoryStorageCorruption(f"Legacy fact in {source_path} is not an object")
                candidate = _normalize_fact(raw_fact, scope=_scope_dict(user_id, agent_name))
                existing, _ = self._read_fact(path, candidate["id"], user_id=user_id, agent_name=agent_name)
                if existing is not None:
                    if not self._migration_equivalent(candidate, existing):
                        raise MemoryStorageCorruption(f"Fact migration conflict for {candidate['id']!r}")
                    continue
                previous = pending.get(candidate["id"])
                if previous is not None:
                    if not self._migration_equivalent(candidate, previous):
                        raise MemoryStorageCorruption(f"Fact migration conflict for {candidate['id']!r}")
                    continue
                pending[candidate["id"]] = candidate
                upserts.append(candidate)

        # Migration is intentionally one-way for the running application.
        # Preserve every destructive v1 JSON source before the first v2 write;
        # a failed/mismatched backup aborts while all source data is untouched.
        for source_path, _ in sources:

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Fix the legacy fact file so it contains a JSON object.
  2. Remove the malformed entry from the legacy source and retry migration.

When it happens

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