{"record":{"id":"980de4d171ddfeda","repo":"bytedance/deer-flow","slug":"invalid-memory-operation-journal-journal-path","errorCode":null,"errorMessage":"Invalid memory operation journal {journal_path}: {exc}","messagePattern":"Invalid memory operation journal (.+?): (.+?)","errorType":"exception","errorClass":"MemoryStorageCorruption","httpStatus":null,"severity":"error","filePath":"backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py","lineNumber":677,"sourceCode":"        \"\"\"Recover or clean a previously journaled multi-file operation.\n\n        Callers hold the scope's in-process and cross-process locks.\n        \"\"\"\n        journal_path = path.parent / \".memory.journal.json\"\n        if not journal_path.exists():\n            return\n        try:\n            journal = json.loads(journal_path.read_text(encoding=\"utf-8\"))\n            operation_id = str(journal[\"operationId\"])\n            if not operation_id or Path(operation_id).name != operation_id:\n                raise TypeError(\"operationId must be a plain path component\")\n            state = journal.get(\"state\")\n            old_entries = journal.get(\"oldEntries\", {})\n            agent_name = journal.get(\"agentName\")\n            if agent_name is not None and not isinstance(agent_name, str):\n                raise TypeError(\"agentName must be a string or null\")\n        except (OSError, json.JSONDecodeError, KeyError, TypeError) as exc:\n            raise MemoryStorageCorruption(f\"Invalid memory operation journal {journal_path}: {exc}\") from exc\n        recovery_dir = path.parent / \".recovery\" / operation_id\n        if state == \"prepared\":\n            backup_manifest = recovery_dir / \"memory.json\"\n            if backup_manifest.exists():\n                _atomic_write(path, backup_manifest.read_bytes())\n            elif int(journal.get(\"expectedRevision\") or 0) == 0:\n                path.unlink(missing_ok=True)\n            if isinstance(old_entries, dict):\n                old_ids = set(old_entries)\n                for fact_id in journal.get(\"factIds\", []):\n                    if fact_id not in old_ids:\n                        if agent_name is None:\n                            raise MemoryStorageCorruption(f\"Journal {journal_path} contains facts without agentName\")\n                        fact_file_path(path, str(fact_id), agent_name=agent_name).unlink(missing_ok=True)\n                for fact_id, entry in old_entries.items():\n                    if not isinstance(fact_id, str) or not fact_id or any(character not in \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-\" for character in fact_id):\n                        raise MemoryStorageCorruption(f\"Journal {journal_path} contains an invalid fact id\")\n                    if not isinstance(entry, dict) or not isinstance(entry.get(\"path\"), str):","sourceCodeStart":659,"sourceCodeEnd":695,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py#L659-L695","documentation":"Error \"Invalid memory operation journal {journal_path}: {exc}\" thrown in bytedance/deer-flow.","triggerScenarios":"Thrown at backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py:677 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}