FoundationAgents/MetaGPT · error · FileNotFoundError

No requirement document found.

Error message

No requirement document found.

What it means

WritePrd (the Product Manager action) loads the requirement document from the workspace via Document.load(requirements_filename) (default 'requirement.txt' or the new_doc filename). If the loaded Document is falsy — file missing, empty, or load returned an empty Document — it raises FileNotFoundError('No requirement document found.'). The pipeline refuses to write a PRD without an input requirement.

Source

Thrown at metagpt/actions/write_prd.py:157

            self.repo = ProjectRepo(self.context.kwargs.project_path)
            await self.repo.docs.save(filename=REQUIREMENT_FILENAME, content=with_messages[-1].content)
            self.input_args = AIMessage.create_instruct_value(
                kvs={
                    "project_path": self.context.kwargs.project_path,
                    "requirements_filename": str(self.repo.docs.workdir / REQUIREMENT_FILENAME),
                    "prd_filenames": [str(self.repo.docs.prd.workdir / i) for i in self.repo.docs.prd.all_files],
                },
                class_name="PrepareDocumentsOutput",
            )
        else:
            self.repo = ProjectRepo(self.input_args.project_path)
        req = await Document.load(filename=self.input_args.requirements_filename)
        docs: list[Document] = [
            await Document.load(filename=i, project_path=self.repo.workdir) for i in self.input_args.prd_filenames
        ]

        if not req:
            raise FileNotFoundError("No requirement document found.")

        if await self._is_bugfix(req.content):
            logger.info(f"Bugfix detected: {req.content}")
            return await self._handle_bugfix(req)
        # remove bugfix file from last round in case of conflict
        await self.repo.docs.delete(filename=BUGFIX_FILENAME)

        # if requirement is related to other documents, update them, otherwise create a new one
        if related_docs := await self.get_related_docs(req, docs):
            logger.info(f"Requirement update detected: {req.content}")
            await self._handle_requirement_update(req=req, related_docs=related_docs)
        else:
            logger.info(f"New requirement detected: {req.content}")
            await self._handle_new_requirement(req)

        kvs = self.input_args.model_dump()
        kvs["changed_prd_filenames"] = [
            str(self.repo.docs.prd.workdir / i) for i in list(self.repo.docs.prd.changed_files.keys())

View on GitHub (pinned to 11cdf466d0)

Solutions

  1. Create the requirements file in the workspace (default: requirement.txt at workspace root) with your feature request text.
  2. Set the correct requirements_filename in your input args/config to point at the existing file.
  3. If using --project_path, confirm the project directory contains the expected docs structure and requirement file.
  4. Verify the file is non-empty; a 0-byte requirement also fails the truthiness check.

Example fix

# before
$ metagpt "write a todo app"   # workspace has no requirement.txt

# after
echo "write a todo app" > /path/to/workspace/requirement.txt
$ metagpt --project_path /path/to/workspace
Defensive patterns

Strategy: validation

Validate before calling

req_path = workspace / input_args.requirements_filename
if not req_path.is_file() or req_path.stat().st_size == 0:
    raise SystemExit(f'Requirement file missing or empty: {req_path}')
await write_prd.run(...)

Prevention

When it happens

Trigger: Running WritePrd (or the full software-company flow / 'meta' command) in a workspace where the requirements file does not exist or is empty; passing input_args.requirements_filename pointing at a non-existent file; using --project_path for a directory whose docs/ lacks the requirement file.

Common situations: Running metagpt before creating requirement.txt; typos in the requirements filename in config; workspace path misconfigured so the relative path resolves elsewhere; empty requirement file after a failed write.

Related errors


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