Exception in role's execution, deletion of newest role communication message throws another exception and exits application process
Bug description
While executing and preparing files, the following logs show initializing failed for one of the roles and in order to fix it, entire metagpt process crashed and exited out. Attached logs below from the project specifying stacktrace as is from console:
2025-01-07 01:28:33.166 | 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. 2025-01-07 01:28:33.275 | ERROR | metagpt.utils.common:wrapper:631 - Exception occurs, start to serialize the project, exp: Traceback (most recent call last): File "<PATH>\venv\lib\site-packages\tenacity\_asyncio.py", line 50, in __call__ result = await fn(*args, **kwargs) File "<PATH>/venv\lib\site-packages\metagpt\actions\action_node.py", line 432, in _aask_v1 instruct_content = output_class(**parsed_data)
Bug solved method
Environment information
- LLM type and model name: qwen-2.5-coder 32b
- System version: Windows 11
- Python version: 3.9.11 (VirtualEnv)
- MetaGPT version or branch: master cli
- packages version: used venv to initialize and write wrapper to create crud application in Java
- installation method: pip install --upgrade metagpt
Screenshots or logs
2025-01-07 01:28:33.162 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 343.484(s), this was the 6th time calling it. exp: 1 validation error for PM_NODE_AN
Value error, Missing fields: {'Required Python packages'} [type=value_error, input_value={'Required Java packages'...or terminal operators.'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.6/v/value_error 2025-01-07 01:28:33.166 | 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. 2025-01-07 01:28:33.275 | ERROR | metagpt.utils.common:wrapper:631 - Exception occurs, start to serialize the project, exp: Traceback (most recent call last): File "C:\Projects\projmgpt\venv\lib\site-packages\tenacity_asyncio.py", line 50, in call result = await fn(*args, **kwargs) File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\actions\action_node.py", line 432, in _aask_v1 instruct_content = output_class(**parsed_data) pydantic_core._pydantic_core.ValidationError: 1 validation error for PM_NODE_AN Value error, Missing fields: {'Required Python packages'} [type=value_error, input_value={'Required Java packages'...or terminal operators.'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.6/v/value_error
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\utils\common.py", line 640, in wrapper return await func(self, *args, **kwargs) File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\roles\role.py", line 550, in run rsp = await self.react() tenacity.RetryError: RetryError[<Future at 0x224aceb39d0 state=finished raised ValidationError>]
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\utils\common.py", line 626, in wrapper result = await func(self, *args, **kwargs) File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\team.py", line 134, in run await self.env.run() Exception: Traceback (most recent call last): File "C:\Projects\projmgpt\venv\lib\site-packages\tenacity_asyncio.py", line 50, in call result = await fn(*args, **kwargs) File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\actions\action_node.py", line 432, in _aask_v1 instruct_content = output_class(**parsed_data) File "C:\Projects\projmgpt\venv\lib\site-packages\pydantic\main.py", line 171, in init self.pydantic_validator.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 1 validation error for PM_NODE_AN Value error, Missing fields: {'Required Python packages'} [type=value_error, input_value={'Required Java packages'...or terminal operators.'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.6/v/value_error
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\utils\common.py", line 640, in wrapper return await func(self, *args, **kwargs) File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\roles\role.py", line 550, in run rsp = await self.react() File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\roles\role.py", line 517, in react rsp = await self._react() File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\roles\role.py", line 463, in _react rsp = await self._act() File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\roles\role.py", line 392, in _act response = await self.rc.todo.run(self.rc.history) File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\actions\project_management.py", line 43, in run task_doc = await self._update_tasks(filename=filename) File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\actions\project_management.py", line 66, in _update_tasks rsp = await self._run_new_tasks(context=system_design_doc.content) File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\actions\project_management.py", line 76, in _run_new_tasks node = await PM_NODE.fill(context, self.llm, schema=self.prompt_schema) File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\actions\action_node.py", line 505, in fill return await self.simple_fill(schema=schema, mode=mode, images=images, timeout=timeout, exclude=exclude) File "C:\Projects\projmgpt\venv\lib\site-packages\metagpt\actions\action_node.py", line 457, in simple_fill content, scontent = await self.aask_v1( File "C:\Projects\projmgpt\venv\lib\site-packages\tenacity_asyncio.py", line 88, in async_wrapped return await fn(*args, **kwargs) File "C:\Projects\projmgpt\venv\lib\site-packages\tenacity_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) File "C:\Projects\projmgpt\venv\lib\site-packages\tenacity_init.py", line 326, in iter raise retry_exc from fut.exception() tenacity.RetryError: RetryError[<Future at 0x224aceb39d0 state=finished raised ValidationError>]
2025-01-07 01:28:33.162 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 343.484(s), this was the 6th time calling it. exp: 1 validation error for PM_NODE_AN
Value error, Missing fields: {'Required Python packages'} [type=value_error, input_value={'Required Java packages'...or terminal operators.'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.6/v/value_error
The LLM did not follow the instructions to return data in the required format, resulting in the failure to parse the data. It is suggested to use other LLM.
This issue has no activity in the past 30 days. Please comment on the issue if you have anything to add.
This issue was closed due to 45 days of inactivity. If you feel this issue is still relevant, please reopen the issue to continue the discussion.