Repository navigation
Description
Description
What happened?
OpenCode can enter an effectively infinite tool-call loop when the agent encounters a missing file/path or cannot resolve an implementation detail.
Instead of stopping, asking for clarification, or reporting that the required information is unavailable, the agent repeatedly issues the same investigation intent without producing a new tool call or new information.
Example:
The agent attempted to locate a catalog API client file that did not exist at the requested path:
src/lib/api/catalog.ts
The tool returned:
Cannot find path ... src\lib\api\catalog.ts because it does not exist
After that, the agent repeatedly generated messages such as:
- "Let me find the catalog api client."
- "Let me search for it."
- "Let me locate the catalog api client."
- "Let me read PlanCatalogPage.tsx."
- "Let me search once."
- "Let me grep."
- "Let me search for the relevant wiring."
This continued for a very large number of iterations without making meaningful progress.
The same behavior also occurred when the agent was trying to verify unresolved implementation details. It repeatedly announced that it would perform the same read/search operation instead of stopping when the required information could not be obtained.
This is especially problematic for autonomous coding workflows because:
- it wastes a large number of tool calls/tokens
- it can consume the entire execution budget
- it delays the actual task indefinitely
- there is no effective loop-breaker when the investigation produces no new information
- the user receives no useful failure state or request for clarification
Expected behavior
When the same investigation attempt fails repeatedly, or when consecutive tool calls produce no new information, the agent should detect the loop and stop.
It should instead report something like:
"I cannot locate the requested file/path. I have already attempted the available search paths and received no new information. Please provide the correct path or clarify where the implementation is located."
A bounded retry policy or no-progress detection would be sufficient.
For example:
- retry a missing-path search a limited number of times
- detect repeated identical tool intents/results
- stop after N consecutive no-progress iterations
- ask the user for clarification when the required information cannot be resolved
The important point is that the agent should not continue generating "Let me search/read/find..." messages indefinitely without an actual new tool action or new information.
Plugins
No response
OpenCode version
1.18.18
Steps to reproduce
- Start an OpenCode coding session in a project.
- Give the agent a task that requires investigating a specific implementation or file.
- Make the referenced file/path incorrect, missing, renamed, or otherwise unavailable.
- Allow the agent to investigate using its normal search/read tools.
- Observe the agent after the tool reports that the file/path does not exist.
- The agent repeatedly generates investigation messages such as "Let me search", "Let me read", "Let me find it", etc., without making meaningful progress or stopping.
- The loop can continue for a very large number of iterations and consume the execution budget.
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
PowerShell
Activity
github-actions commentedon Aug 20, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct (e.g. specific to file-investigation tool intents rather than MCP or stream errors), feel free to clarify and a maintainer will triage accordingly.
Adeldes commentedon Aug 23, 2026
I can confirm this behavior reproduced in a real OpenCode session after filing this issue.
I analyzed the exported session in detail, and the failure mode is broader than the original missing-file example.
Affected session:
1.18.3deepseek-v4-flashviaopencode-goses_07a43c0c7ffeSWAifUdGDTYopvDuring the affected period (Aug 17–18), the agent repeatedly regenerated the same investigation intent and continued the execution cycle without meaningful progress.
For example, the reasoning stream contains large repeated sequences of:
Let me read...Let me read the file.Let me read it.Let me search...Let me grep...Let me apply the fix...In one analyzed window on Aug 18 (02:00–03:20 UTC+3), there were 108 tool events, with extensive repeated investigation/reasoning around the same targets.
This appears to be a no-progress/circuit-breaker failure: the agent does not reliably recognize that repeated investigation is no longer producing new information, and it continues consuming execution budget instead of stopping or asking for clarification.
I believe this is related to the core issue described here, but it is broader than a single missing-path retry and is not limited to an MCP or transport retry loop.
I have also opened a support request regarding the abnormal usage/cost from this session. I can provide the full session export and extracted analysis if useful.
agentgoblin commentedon Aug 27, 2026
How about
doom_looppermission? #45442 (comment)thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊