MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

When I want to use incremental mode , the error ocurrs

Open visionKinger opened this issue 1 year ago • 2 comments

Bug description When I want to use incremental mode , the error ocurrs

rsp = await self.react() ValueError: Call with_srcs first.

During handling of the above exception, another exception occurred:

visionKinger avatar Jul 25 '24 06:07 visionKinger

What is the full command you executed?

shenchucheng avatar Jul 25 '24 06:07 shenchucheng

@shenchucheng

I get the same error when running the iterative guide using the given command in the documentation:

metagpt "Add a randomly appearing enemy that lasts for 5 seconds. If the enemy is eaten, the game ends. If the enemy is not eaten, it disappears after 5 seconds." --project-path "snake_game" --run-tests --n-round 20 --max-auto-summarize-code 1

AndersVO avatar Aug 22 '24 11:08 AndersVO

The project path generated by metagpt is under workspace folder, such as workspace/snake_game. It seems that you filled in the --project-path parameter incorrectly, which is why metagpt could not find the source code and gave the error. It is recommended to use an absolute path.

iorisa avatar Oct 11 '24 02:10 iorisa

If there are no further questions, this issue will be closed. If you have any other questions, you can reopen this issue or create a new one.

iorisa avatar Oct 12 '24 11:10 iorisa

Just tried it with the "workspace/snake_game"

However I still get the trace coming back to the original error:

2024-10-13 06:55:20.365 | WARNING  | metagpt.utils.common:wrapper:649 - There is a exception in role's execution, in order to resume, we delete the newest role communication message in the role's memory.
2024-10-13 06:55:20.391 | ERROR    | metagpt.utils.common:wrapper:631 - Exception occurs, start to serialize the project, exp:
Traceback (most recent call last):
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/utils/common.py", line 640, in wrapper
    return await func(self, *args, **kwargs)
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/roles/role.py", line 550, in run
    rsp = await self.react()
ValueError: Call with_srcs first.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/utils/common.py", line 626, in wrapper
    result = await func(self, *args, **kwargs)
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/team.py", line 134, in run
    await self.env.run()
Exception: Traceback (most recent call last):
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/utils/common.py", line 640, in wrapper
    return await func(self, *args, **kwargs)
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/roles/role.py", line 550, in run
    rsp = await self.react()
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/roles/role.py", line 517, in react
    rsp = await self._react()
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/roles/role.py", line 463, in _react
    rsp = await self._act()
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/roles/engineer.py", line 148, in _act
    return await self._act_write_code()
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/roles/engineer.py", line 155, in _act_write_code
    changed_files = await self._act_sp_with_cr(review=self.use_code_review)
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/roles/engineer.py", line 111, in _act_sp_with_cr
    coding_context = await todo.run()
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/actions/write_code.py", line 109, in run
    code_context = await self.get_codes(
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/actions/write_code.py", line 171, in get_codes
    src_file_repo = project_repo.srcs
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/utils/project_repo.py", line 128, in srcs
    raise ValueError("Call with_srcs first.")
ValueError: Call with_srcs first.

However after running the same command again it feels like it goes beyond and I get the same error as has been raised in the grouping:

_act_write_code
    changed_files = await self._act_sp_with_cr(review=self.use_code_review)
  File "/anaconda/envs/azureml_py38/lib/python3.9/site-packages/metagpt/roles/engineer.py", line 120, in _act_sp_with_cr
    dependencies.add(coding_context.code_plan_and_change_doc.root_relative_path)
AttributeError: 'NoneType' object has no attribute 'root_relative_path'

AndersVO avatar Oct 13 '24 06:10 AndersVO