{"record":{"id":"37ed6a1e5de76aca","repo":"FoundationAgents/MetaGPT","slug":"recover-storage-meta-file-team-json-not-exist-n","errorCode":null,"errorMessage":"recover storage meta file `team.json` not exist, not to recover and please start a new project.","messagePattern":"recover storage meta file `team\\.json` not exist, not to recover and please start a new project\\.","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"metagpt/team.py","lineNumber":73,"sourceCode":"            self.hire(data[\"roles\"])\n        if \"env_desc\" in data:\n            self.env.desc = data[\"env_desc\"]\n\n    def serialize(self, stg_path: Path = None):\n        stg_path = SERDESER_PATH.joinpath(\"team\") if stg_path is None else stg_path\n        team_info_path = stg_path.joinpath(\"team.json\")\n        serialized_data = self.model_dump()\n        serialized_data[\"context\"] = self.env.context.serialize()\n\n        write_json_file(team_info_path, serialized_data)\n\n    @classmethod\n    def deserialize(cls, stg_path: Path, context: Context = None) -> \"Team\":\n        \"\"\"stg_path = ./storage/team\"\"\"\n        # recover team_info\n        team_info_path = stg_path.joinpath(\"team.json\")\n        if not team_info_path.exists():\n            raise FileNotFoundError(\n                \"recover storage meta file `team.json` not exist, \" \"not to recover and please start a new project.\"\n            )\n\n        team_info: dict = read_json_file(team_info_path)\n        ctx = context or Context()\n        ctx.deserialize(team_info.pop(\"context\", None))\n        team = Team(**team_info, context=ctx)\n        return team\n\n    def hire(self, roles: list[Role]):\n        \"\"\"Hire roles to cooperate\"\"\"\n        self.env.add_roles(roles)\n\n    @property\n    def cost_manager(self):\n        \"\"\"Get cost manager\"\"\"\n        return self.env.context.cost_manager\n","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/FoundationAgents/MetaGPT/blob/11cdf466d042aece04fc6cfd13b28e1a70341b1f/metagpt/team.py#L55-L91","documentation":"Team.deserialize expects stg_path to be a serialized team workspace; it looks for team.json inside it (written by Team.serialize). If that metadata file is absent, recovery is impossible and this FileNotFoundError tells the user to start a new project instead.","triggerScenarios":"Calling Team.deserialize(stg_path) on a directory that lacks team.json — e.g. pointing at the project root, an incompletely serialized workspace, or a path where serialization crashed before writing team.json.","commonSituations":"Recovery after a crashed run that died before serialize completed; copying only part of the workspace; passing workspace/<project> instead of workspace/<project>/team.","solutions":["Verify stg_path contains team.json: ls workspace/<project>/team/team.json","Use the correct subdirectory (the one ending in team) as stg_path","If team.json is genuinely missing, start a fresh project — there is nothing to recover"],"exampleFix":"// before\nteam = Team.deserialize(stg_path=Path(\"workspace/proj\"))  # no team.json there\n\n// after\nstg = Path(\"workspace/proj/team\")\nassert (stg / \"team.json\").exists()\nteam = Team.deserialize(stg_path=stg)","handlingStrategy":"validation","validationCode":"from pathlib import Path\nteam_json = Path(stg_path) / \"team.json\"\nif not team_json.is_file():\n    raise FileNotFoundError(f\"{team_json} missing; nothing to recover, start a new project\")","typeGuard":"from pathlib import Path\n\ndef is_recoverable_team_dir(stg_path) -> bool:\n    return (Path(stg_path) / \"team.json\").is_file()","tryCatchPattern":"try:\n    team = Team.deserialize(stg_path=stg)\nexcept FileNotFoundError as e:\n    if \"team.json\" in str(e):\n        hits = [p.parent for p in Path(\"workspace\").rglob(\"team.json\")]\n        if not hits:\n            raise\n        team = Team.deserialize(stg_path=hits[0])  # locate the real team dir\n    else:\n        raise","preventionTips":["Check for team.json before calling deserialize","Let Team.serialize complete fully (it writes team.json last) before killing a run","Archive the whole team directory, not individual files"],"tags":["recovery","serialization","team","file-not-found"],"backgroundTag":null,"analyzedSha":"11cdf466d042aece04fc6cfd13b28e1a70341b1f","analyzedAt":"2026-08-14T23:20:02.994Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}