You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Thinking mode gets stuck in infinite repetition loop (!!!!!!!!!!) #25129
When using opencode with thinking mode, the Qwen 3.6 Pro model gets stuck in a repetitive thinking loop where it outputs repeated characters like !!!!!!!!!!!!!!!!!!... or ... indefinitely instead of producing useful reasoning. I had to switch to a different model (DeepSeek v4 Pro) just to be able to write this bug report, because the Qwen model had become completely unusable.
This manifests as a hanging/corrupted response that the user eventually has to interrupt, and opencode may then produce malformed tool calls (JSON parse errors, truncated function arguments).
Steps to Reproduce
Use opencode with Qwen 3.6 Pro (thinking mode)
Execute a moderate-length session with multiple tool calls
Eventually the thinking blocks start containing infinite repetition of characters like !!!!!!!!! or ...
This corrupts subsequent tool calls (JSON parse errors like JSON Parse error: Expected '}')
At this point the model becomes unusable — even basic commands start producing corrupted output
Expected Behavior
opencode should detect repetitive character patterns in thinking blocks and either:
Discard the thinking output and abort the current request
Restart the request without the corrupted thinking context
Suggested Fix
Add a guard in the thinking block processing that checks for repeated characters. If any character repeats more than N times consecutively (e.g. 10), discard the thinking output and retry the request. This prevents the repetition from consuming tokens and corrupting the subsequent tool call generation.
Pseudocode:
if re.search(r'(.)\1{10,}', thinking_text):
# Thinking is in a repetition loop, abort and retry
raise RepetitiveThinkingError
Environment
opencode CLI
Model: Qwen 3.6 Pro (via Fireworks AI) — the model that exhibits the bug
Switched to: DeepSeek v4 Pro — had to switch models to even write this bug report
Workspace filter: /root/capture/classify
Impact
This causes session degradation in long conversations, requiring the user to manually interrupt and restart (or even switch models entirely). Tool calls after the thinking loop are often malformed (truncated JSON), leading to "Invalid input" errors.
I'm experiencing the same issue on Windows (PowerShell). Claude Sonnet 4.6 with medium thinking enabled is essentially unusable in OpenCode — the model gets stuck planning in the thinking trace and never executes the actual tool calls.
Same class of bug here, but with DeepSeek V4 Flash Free (opencode/deepseek-v4-flash-free) — so it's not Qwen-specific.
During thinking, the model starts escalating exclamation marks and then gets stuck repeating them indefinitely:
¡INTERESANTE!
¡¡¡AHORA LO VEO!!!
¡¡¡ESPERA!!! ¡¡AHORA LO TENGO!!!
¡¡¡AH!!! ¡¡¡AHORA SÍ!!! ¡¡¡YA LO TENGO!!!
¡¡¡¿¿¿EL ECHO???!!!
After that it keeps outputting those signs non-stop and never produces a usable response.
Environment:
Model: opencode/deepseek-v4-flash-free
OpenCode: 1.18.18
OS: Linux x86_64
When: happened during a long session with multiple tool calls.
Recovery: the session does not recover after this — the response has to be interrupted manually.
The escalating ! → !!! → ¡¡¡ pattern is the same degeneration loop described here. A repetition guard in thinking-block processing (abort + retry when a repeated-character pattern is detected, e.g. (.)\1{10,}) would cover this case too, since it's clearly not model-specific.
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.
Activity
github-actions commentedon Apr 30, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct (e.g., different root cause or reproduction steps), please clarify how it differs from the above.
PierrunoYT commentedon May 12, 2026
I'm experiencing the same issue on Windows (PowerShell). Claude Sonnet 4.6 with medium thinking enabled is essentially unusable in OpenCode — the model gets stuck planning in the thinking trace and never executes the actual tool calls.
eznix86 commentedon May 14, 2026
same with opencode go (qwen 3.6 plus)
Long-Trinh-Tien commentedon May 16, 2026
I'm facing same issue while using qwen 3.6 plus (opencode go sub)
dontcrash commentedon Jul 3, 2026
If you use LM Studio:
lmstudio-ai/lmstudio-bug-tracker#1974 (comment)
carstenSpraener commentedon Aug 5, 2026
Same here: opencode lm-studio qwen36-27B on M5Max.
My fix: Stop using opencode and switched to hermes. That works perfect.
ekoleszar commentedon Aug 15, 2026
Same class of bug here, but with DeepSeek V4 Flash Free (
opencode/deepseek-v4-flash-free) — so it's not Qwen-specific.During thinking, the model starts escalating exclamation marks and then gets stuck repeating them indefinitely:
After that it keeps outputting those signs non-stop and never produces a usable response.
Environment:
opencode/deepseek-v4-flash-freeWhen: happened during a long session with multiple tool calls.
Recovery: the session does not recover after this — the response has to be interrupted manually.
The escalating
!→!!!→¡¡¡pattern is the same degeneration loop described here. A repetition guard in thinking-block processing (abort + retry when a repeated-character pattern is detected, e.g.(.)\1{10,}) would cover this case too, since it's clearly not model-specific.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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊
hholst80 commentedon Oct 13, 2026
Note to any internet visitor: if you are on an older version you need to upgrade first within the minor before you can upgrade the major (to v2)