FoundationAgents/MetaGPT · error · FileNotFoundError

{recover_path} not exists or not endswith `team`

Error message

{recover_path} not exists or not endswith `team`

What it means

software_company.start's recover branch validates the --recover-path argument: the path must exist and its string form must end with "team" (the serialized Team workspace directory, typically ./workspace/<project>/team). Violating either condition raises this FileNotFoundError.

Source

Thrown at metagpt/software_company.py:66

                ProductManager(),
                Architect(),
                Engineer2(),
                # ProjectManager(),
                DataAnalyst(),
            ]
        )

        # if implement or code_review:
        #     company.hire([Engineer(n_borg=5, use_code_review=code_review)])
        #
        # if run_tests:
        #     company.hire([QaEngineer()])
        #     if n_round < 8:
        #         n_round = 8  # If `--run-tests` is enabled, at least 8 rounds are required to run all QA actions.
    else:
        stg_path = Path(recover_path)
        if not stg_path.exists() or not str(stg_path).endswith("team"):
            raise FileNotFoundError(f"{recover_path} not exists or not endswith `team`")

        company = Team.deserialize(stg_path=stg_path, context=ctx)
        idea = company.idea

    company.invest(investment)
    asyncio.run(company.run(n_round=n_round, idea=idea))

    return ctx.kwargs.get("project_path")


@app.command("", help="Start a new project.")
def startup(
    idea: str = typer.Argument(None, help="Your innovative idea, such as 'Create a 2048 game.'"),
    investment: float = typer.Option(default=3.0, help="Dollar amount to invest in the AI company."),
    n_round: int = typer.Option(default=5, help="Number of rounds for the simulation."),
    code_review: bool = typer.Option(default=True, help="Whether to use code review."),
    run_tests: bool = typer.Option(default=False, help="Whether to enable QA for adding & running tests."),
    implement: bool = typer.Option(default=True, help="Enable or disable code implementation."),

View on GitHub (pinned to 11cdf466d0)

Solutions

  1. Point --recover-path at the exact team directory, e.g. ./workspace/my_project/team
  2. Verify with ls that the directory exists and contains team.json before running
  3. If the team dir is gone, start a new project instead of recovering

Example fix

// before
metagpt "my idea" --recover-path workspace/my_project  # FileNotFoundError

// after
metagpt "my idea" --recover-path workspace/my_project/team
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
p = Path(recover_path)
if not (p.exists() and str(p).endswith("team")):
    raise FileNotFoundError(f"{p} must be an existing .../team directory")

Type guard

from pathlib import Path

def is_team_workspace(path) -> bool:
    p = Path(path)
    return p.exists() and str(p).endswith("team") and (p / "team.json").exists()

Try / catch

try:
    ctx = start(idea, recover_path=rp, ...)
except FileNotFoundError as e:
    if "not endswith `team`" in str(e):
        rp = str(Path(rp) / "team")  # common fix: user passed project root
        ctx = start(idea, recover_path=rp, ...)
    else:
        raise

Prevention

When it happens

Trigger: Running metagpt --recover-path <p> where <p> is typo'd, points to the project root instead of the .../team subdirectory, or the workspace was never serialized.

Common situations: Passing workspace/project instead of workspace/project/team; recovering on a different machine where the storage dir was not copied; trailing-slash or relative-path mistakes.

Related errors


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