Bug description
MetaGPT crashes in incremental mode during the engineer/write-code phase with:
ValueError: Call with_srcs first.
This appears to happen because the incremental code path accesses project_repo.srcs before initializing the source path via with_src_path(...).
Bug solved method
Not solved upstream yet.
Possible root cause:
In metagpt/actions/write_code.py, WriteCode.run() behaves differently for normal vs incremental mode.
Non-incremental branch:
project_repo=self.repo.with_src_path(self.context.src_workspace)
Incremental branch:
Later, get_codes() calls:
src_file_repo = project_repo.srcs
But in metagpt/utils/project_repo.py, project_repo.srcs raises:
ValueError("Call with_srcs first.")
if _srcs_path was never initialized.
So the incremental path seems to miss a required initialization step before using project_repo.srcs.
Environment information
Screenshots or logs
Relevant traceback:
Traceback (most recent call last):
File ".../metagpt/utils/common.py", line 664, in wrapper
return await func(self, *args, **kwargs)
File ".../metagpt/roles/role.py", line 551, in run
rsp = await self.react()
File ".../metagpt/roles/role.py", line 520, in react
rsp = await self._react()
File ".../metagpt/roles/role.py", line 475, in _react
rsp = await self._act()
File ".../metagpt/roles/engineer.py", line 149, in _act
return await self._act_write_code()
File ".../metagpt/roles/engineer.py", line 156, in _act_write_code
changed_files = await self._act_sp_with_cr(review=self.use_code_review)
File ".../metagpt/roles/engineer.py", line 112, in _act_sp_with_cr
coding_context = await todo.run()
File ".../metagpt/actions/write_code.py", line 109, in run
code_context = await self.get_codes(
File ".../metagpt/actions/write_code.py", line 171, in get_codes
src_file_repo = project_repo.srcs
File ".../metagpt/utils/project_repo.py", line 128, in srcs
raise ValueError("Call with_srcs first.")
ValueError: Call with_srcs first.
Additional note:
This does not appear to be an Ollama runtime issue. The local model continues working correctly; the crash occurs inside MetaGPT's incremental write-code flow.
Bug description
MetaGPT crashes in incremental mode during the engineer/write-code phase with:
This appears to happen because the incremental code path accesses
project_repo.srcsbefore initializing the source path viawith_src_path(...).Bug solved method
Not solved upstream yet.
Possible root cause:
In
metagpt/actions/write_code.py,WriteCode.run()behaves differently for normal vs incremental mode.Non-incremental branch:
Incremental branch:
Later,
get_codes()calls:But in
metagpt/utils/project_repo.py,project_repo.srcsraises:if
_srcs_pathwas never initialized.So the incremental path seems to miss a required initialization step before using
project_repo.srcs.Environment information
LLM type and model name:
thinkbook-coder:latest(based onqwen2.5-coder:7b)System version:
10.0.26100Python version:
3.11.9MetaGPT version or branch:
0.8.2packages version:
metagpt 0.8.2installation method:
pip install metagptScreenshots or logs
Relevant traceback:
Additional note:
This does not appear to be an Ollama runtime issue. The local model continues working correctly; the crash occurs inside MetaGPT's incremental write-code flow.