{"record":{"id":"c7c3b85cbfa2a8be","repo":"bytedance/deer-flow","slug":"cannot-migrate-previous-default-bucket-legacy-age","errorCode":null,"errorMessage":"Cannot migrate previous default bucket {legacy_agent_dir}: unexpected entries {names}","messagePattern":"Cannot migrate previous default bucket (.+?): unexpected entries (.+?)","errorType":"exception","errorClass":"MemoryStorageCorruption","httpStatus":null,"severity":"error","filePath":"backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py","lineNumber":562,"sourceCode":"        user_id: str | None,\n    ) -> tuple[bool, list[RetrievalNotification]]:\n        \"\"\"Move facts written by the earlier ``lead-agent`` default mapping.\n\n        A real custom ``lead-agent`` owns a ``config.yaml`` and is never\n        touched.  A directory with any other unexpected file is also preserved\n        and rejected instead of being guessed at or recursively deleted.\n        \"\"\"\n        legacy_agent_name = \"lead-agent\"\n        legacy_agent_dir = path.parent / \"agents\" / legacy_agent_name\n        if not legacy_agent_dir.exists() or (legacy_agent_dir / \"config.yaml\").is_file():\n            return False, []\n        unexpected = [child for child in legacy_agent_dir.iterdir() if child.name != \"facts\"]\n        legacy_facts_dir = legacy_agent_dir / \"facts\"\n        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)","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py#L544-L580","documentation":"Error \"Cannot migrate previous default bucket {legacy_agent_dir}: unexpected entries {names}\" thrown in bytedance/deer-flow.","triggerScenarios":"Thrown at backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py:562 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Manually move or remove the unexpected entries listed in the legacy bucket directory, then retry migration.","Inspect the directory; only expected memory files may remain for automatic migration."],"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"}