bytedance/deer-flow · error · MemoryStorageCorruption

Unknown journal state {state!r} in {journal_path}

Error message

Unknown journal state {state!r} in {journal_path}

What it means

Error "Unknown journal state {state!r} in {journal_path}" thrown in bytedance/deer-flow.

Source

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

            elif int(journal.get("expectedRevision") or 0) == 0:
                path.unlink(missing_ok=True)
            if isinstance(old_entries, dict):
                old_ids = set(old_entries)
                for fact_id in journal.get("factIds", []):
                    if fact_id not in old_ids:
                        if agent_name is None:
                            raise MemoryStorageCorruption(f"Journal {journal_path} contains facts without agentName")
                        fact_file_path(path, str(fact_id), agent_name=agent_name).unlink(missing_ok=True)
                for fact_id, entry in old_entries.items():
                    if not isinstance(fact_id, str) or not fact_id or any(character not in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-" for character in fact_id):
                        raise MemoryStorageCorruption(f"Journal {journal_path} contains an invalid fact id")
                    if not isinstance(entry, dict) or not isinstance(entry.get("path"), str):
                        continue
                    backup = recovery_dir / f"{fact_id}.md"
                    if backup.exists():
                        _atomic_write(_safe_relative_path(path.parent, entry["path"], label="journal"), backup.read_bytes())
        elif state != "committed":
            raise MemoryStorageCorruption(f"Unknown journal state {state!r} in {journal_path}")
        if recovery_dir.exists():
            shutil.rmtree(recovery_dir)
        journal_path.unlink(missing_ok=True)

    def _commit_changes_locked(
        self,
        path: Path,
        *,
        user_id: str | None,
        agent_name: str | None,
        upserts: list[dict[str, Any]],
        deletes: list[str],
        summaries: dict[str, Any] | None,
        expected_revision: int | None,
        delete_revisions: dict[str, int] | None = None,
        upsert_revisions: dict[str, int | None] | None = None,
    ) -> tuple[dict[str, Any], list[RetrievalNotification]]:
        """Commit only the addressed fact files plus the shared summary JSON.

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Remove the journal file with the unrecognized state; it is from an incompatible version or corrupted.
  2. Report the unknown state value if this recurs on a clean install.

When it happens

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