FoundationAgents/MetaGPT · error · FileNotFoundError

recover storage meta file `team.json` not exist, not to reco

Error message

recover storage meta file `team.json` not exist, not to recover and please start a new project.

What it means

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.

Source

Thrown at metagpt/team.py:73

            self.hire(data["roles"])
        if "env_desc" in data:
            self.env.desc = data["env_desc"]

    def serialize(self, stg_path: Path = None):
        stg_path = SERDESER_PATH.joinpath("team") if stg_path is None else stg_path
        team_info_path = stg_path.joinpath("team.json")
        serialized_data = self.model_dump()
        serialized_data["context"] = self.env.context.serialize()

        write_json_file(team_info_path, serialized_data)

    @classmethod
    def deserialize(cls, stg_path: Path, context: Context = None) -> "Team":
        """stg_path = ./storage/team"""
        # recover team_info
        team_info_path = stg_path.joinpath("team.json")
        if not team_info_path.exists():
            raise FileNotFoundError(
                "recover storage meta file `team.json` not exist, " "not to recover and please start a new project."
            )

        team_info: dict = read_json_file(team_info_path)
        ctx = context or Context()
        ctx.deserialize(team_info.pop("context", None))
        team = Team(**team_info, context=ctx)
        return team

    def hire(self, roles: list[Role]):
        """Hire roles to cooperate"""
        self.env.add_roles(roles)

    @property
    def cost_manager(self):
        """Get cost manager"""
        return self.env.context.cost_manager

View on GitHub (pinned to 11cdf466d0)

Solutions

  1. Verify stg_path contains team.json: ls workspace/<project>/team/team.json
  2. Use the correct subdirectory (the one ending in team) as stg_path
  3. If team.json is genuinely missing, start a fresh project — there is nothing to recover

Example fix

// before
team = Team.deserialize(stg_path=Path("workspace/proj"))  # no team.json there

// after
stg = Path("workspace/proj/team")
assert (stg / "team.json").exists()
team = Team.deserialize(stg_path=stg)
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
team_json = Path(stg_path) / "team.json"
if not team_json.is_file():
    raise FileNotFoundError(f"{team_json} missing; nothing to recover, start a new project")

Type guard

from pathlib import Path

def is_recoverable_team_dir(stg_path) -> bool:
    return (Path(stg_path) / "team.json").is_file()

Try / catch

try:
    team = Team.deserialize(stg_path=stg)
except FileNotFoundError as e:
    if "team.json" in str(e):
        hits = [p.parent for p in Path("workspace").rglob("team.json")]
        if not hits:
            raise
        team = Team.deserialize(stg_path=hits[0])  # locate the real team dir
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: Recovery after a crashed run that died before serialize completed; copying only part of the workspace; passing workspace/<project> instead of workspace/<project>/team.

Related errors


AI-assisted analysis of FoundationAgents/MetaGPT@11cdf466d0 (2026-08-14). Data as JSON: /api/errors/37ed6a1e5de76aca. Report an issue: GitHub.