{"record":{"id":"67af4685ac0bedd4","repo":"bytedance/deer-flow","slug":"expected-fact-fact-id-r-revision-delete-revisio","errorCode":null,"errorMessage":"Expected fact {fact_id!r} revision {delete_revisions[fact_id]}, found {existing.get('revision')}","messagePattern":"Expected fact (.+?) revision (.+?), found (.+?)","errorType":"exception","errorClass":"MemoryFactRevisionConflict","httpStatus":null,"severity":"error","filePath":"backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py","lineNumber":770,"sourceCode":"                        raise MemoryFactRevisionConflict(f\"Expected fact {fact_id!r} revision {expected_fact_revision}, found {actual_fact_revision}\")\n            normalized = _normalize_fact(candidate, scope=scope, existing=existing)\n            if existing != normalized:\n                prepared[fact_id] = (normalized, existing, fact_path)\n\n        delete_ids = [str(fact_id) for fact_id in deletes]\n        if len(delete_ids) != len(set(delete_ids)):\n            raise ValueError(\"Duplicate fact ids are not allowed in deletes\")\n        removals: dict[str, tuple[dict[str, Any], Path]] = {}\n        for fact_id in delete_ids:\n            if fact_id in prepared:\n                raise ValueError(f\"Fact {fact_id!r} cannot be upserted and deleted together\")\n            if agent_name is None:  # guarded above\n                raise ValueError(\"agent_name is required for fact repository changes\")\n            existing, fact_path = self._read_fact(path, fact_id, user_id=user_id, agent_name=agent_name)\n            if existing is None:\n                continue\n            if delete_revisions and fact_id in delete_revisions and delete_revisions[fact_id] != existing.get(\"revision\"):\n                raise MemoryFactRevisionConflict(f\"Expected fact {fact_id!r} revision {delete_revisions[fact_id]}, found {existing.get('revision')}\")\n            removals[fact_id] = (existing, fact_path)\n\n        base = current_memory or create_empty_memory()\n        user_section = copy.deepcopy(base.get(\"user\", {}))\n        history_section = copy.deepcopy(base.get(\"history\", {}))\n        if summaries is not None:\n            if not isinstance(summaries, dict):\n                raise ValueError(\"change_set.summaries must be an object\")\n            if \"user\" in summaries:\n                if not isinstance(summaries[\"user\"], dict):\n                    raise ValueError(\"change_set.summaries.user must be an object\")\n                user_section.update(copy.deepcopy(summaries[\"user\"]))\n            if \"history\" in summaries:\n                if not isinstance(summaries[\"history\"], dict):\n                    raise ValueError(\"change_set.summaries.history must be an object\")\n                history_section.update(copy.deepcopy(summaries[\"history\"]))\n        summaries_changed = user_section != base.get(\"user\", {}) or history_section != base.get(\"history\", {})\n        needs_manifest_cleanup = current_memory is None or current_memory.get(\"version\") != DOCUMENT_VERSION or \"facts\" in current_memory","sourceCodeStart":752,"sourceCodeEnd":788,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py#L752-L788","documentation":"Error \"Expected fact {fact_id!r} revision {delete_revisions[fact_id]}, found {existing.get('revision')}\" thrown in bytedance/deer-flow.","triggerScenarios":"Thrown at backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py:770 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-read the fact's current revision and retry the delete with the correct expected revision.","Another writer modified the fact concurrently; coordinate writers."],"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-15T22:17:37.221Z"}