bytedance/deer-flow · error · MemoryStorageCorruption
Invalid memory operation journal {journal_path}: {exc}
Error message
Invalid memory operation journal {journal_path}: {exc} What it means
Error "Invalid memory operation journal {journal_path}: {exc}" thrown in bytedance/deer-flow.
Source
Thrown at backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py:677
"""Recover or clean a previously journaled multi-file operation.
Callers hold the scope's in-process and cross-process locks.
"""
journal_path = path.parent / ".memory.journal.json"
if not journal_path.exists():
return
try:
journal = json.loads(journal_path.read_text(encoding="utf-8"))
operation_id = str(journal["operationId"])
if not operation_id or Path(operation_id).name != operation_id:
raise TypeError("operationId must be a plain path component")
state = journal.get("state")
old_entries = journal.get("oldEntries", {})
agent_name = journal.get("agentName")
if agent_name is not None and not isinstance(agent_name, str):
raise TypeError("agentName must be a string or null")
except (OSError, json.JSONDecodeError, KeyError, TypeError) as exc:
raise MemoryStorageCorruption(f"Invalid memory operation journal {journal_path}: {exc}") from exc
recovery_dir = path.parent / ".recovery" / operation_id
if state == "prepared":
backup_manifest = recovery_dir / "memory.json"
if backup_manifest.exists():
_atomic_write(path, backup_manifest.read_bytes())
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):View on GitHub (pinned to 1dd6ba1acb)
Solutions
- Remove the corrupted journal file; completed operations will not be replayed.
- Restore the journal from a backup if in-flight operations must be recovered.
When it happens
Trigger: Thrown at backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py:677 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/980de4d171ddfeda.
Report an issue: GitHub.