{"record":{"id":"f30cd57bba21bd36","repo":"bytedance/deer-flow","slug":"fact-migration-conflict-for-candidate-id-r","errorCode":null,"errorMessage":"Fact migration conflict for {candidate['id']!r}","messagePattern":"Fact migration conflict for (.+?)","errorType":"exception","errorClass":"MemoryStorageCorruption","httpStatus":null,"severity":"error","filePath":"backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py","lineNumber":576,"sourceCode":"        if legacy_facts_dir.exists():\n            unexpected.extend(child for child in legacy_facts_dir.glob(\"**/*\") if child.is_file() and child.suffix.lower() != \".md\")\n        if unexpected:\n            names = \", \".join(sorted(child.name for child in unexpected))\n            raise MemoryStorageCorruption(f\"Cannot migrate previous default bucket {legacy_agent_dir}: unexpected entries {names}\")\n\n        legacy_facts = self._load_agent_facts(path, legacy_agent_name, user_id=user_id)\n        upserts: list[dict[str, Any]] = []\n        for legacy_fact in legacy_facts:\n            candidate = _normalize_fact(legacy_fact, scope=_scope_dict(user_id, DEFAULT_AGENT_BUCKET))\n            existing, _ = self._read_fact(\n                path,\n                candidate[\"id\"],\n                user_id=user_id,\n                agent_name=DEFAULT_AGENT_BUCKET,\n            )\n            if existing is not None:\n                if not self._migration_equivalent(candidate, existing):\n                    raise MemoryStorageCorruption(f\"Fact migration conflict for {candidate['id']!r}\")\n                continue\n            upserts.append(candidate)\n\n        current_memory = self._load_memory_file(path)\n        _, notifications = self._commit_changes_locked(\n            path,\n            user_id=user_id,\n            agent_name=DEFAULT_AGENT_BUCKET,\n            upserts=upserts,\n            deletes=[],\n            summaries=None,\n            expected_revision=int((current_memory or {}).get(\"revision\") or 0),\n        )\n        # Delete only the source Markdown files that were parsed above. Never\n        # recursively remove this directory: if an unexpected file appears\n        # concurrently, the final rmdir simply leaves it in place.\n        for fact_path in legacy_facts_dir.glob(\"**/*.md\"):\n            fact_path.unlink(missing_ok=True)","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py#L558-L594","documentation":"Error \"Fact migration conflict for {candidate['id']!r}\" thrown in bytedance/deer-flow.","triggerScenarios":"Thrown at backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py:576 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Resolve the conflicting existing fact (delete or update it) before re-running migration.","Inspect both versions and merge their content manually if needed."],"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"}