anomalyco / anomalyco/opencode
Ollama/OpenAI-compatible tool loop stalls with AI_APICallError: no user query found in messages
@kitlangton is already working on this.
Since Sep 4, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
I have this running on a Windows 11 machine and I am using an identical spec and minimal config on my DGX Spark which has no issues. Here is some pertinent information:
Windows 11
OpenCode 1.18.27
Ollama
qwen3.8:27b
provider @ai-sdk/openai-compatible
Log files showe no user query found in messages and the exponential backoff continues, Powershell shows the error if you are watching it. Once the backoff finishes and you check the terminal you just see it hanging. What I have observed:
- This happens after several successful tool calls
- Both build primary agent and explore subagent reproduce it
- GPU becomes idle because Ollama isn't actually performing inference
- OpenCode silently retries with exponential backoff
- Manually sending another user message wakes it up, albeit temporarily, it then goes into the stall again
- direct Ollama inference is healthy (~100+ tok/s)
- model is 100% GPU resident on RTX 5090
This is consistent irrespective of whether I run this ollama launch opencode or just opencode natively.
Plugins
none
OpenCode version
1.18.27
Steps to reproduce
This has happened over several sessions but my most recent is getting it to parse a reasonably complicated feature request (https://github.com/tutors-sdk/tutors-mono-repo/issues/155) and asking it to give me an implementation plan.
Screenshot and/or share link
\.local\share\opencode\snapshot\aefa7daf35affff5b2327338a9f43c3cafa8b03b\f0e390958efa12b33abe2af7db00226d579d9f09"
timestamp=2026-09-04T10:37:58.731Z level=INFO run=0063006d message=process session.id=ses_f940200b5ffe7bp9m3CgOvI9FU messageID=msg_06bff255e00153GrGwmbsaPQuI
timestamp=2026-09-04T10:37:58.732Z level=INFO run=0063006d message=stream providerID=ollama modelID=qwen3.8:27b session.id=ses_f940200b5ffe7bp9m3CgOvI9FU small=false agent=explore mode=subagent
timestamp=2026-09-04T10:37:58.733Z level=INFO run=0063006d message="llm runtime selected" llm.runtime=ai-sdk llm.provider=ollama llm.model=qwen3.8:27b
timestamp=2026-09-04T10:37:58.811Z level=ERROR run=0063006d message="stream error" providerID=ollama modelID=qwen3.8:27b session.id=ses_f940200b5ffe7bp9m3CgOvI9FU small=false agent=explore mode=subagent error.error="AI_APICallError: no user query found in messages"
timestamp=2026-09-04T10:38:01.248Z level=INFO run=0063006d message=stream providerID=ollama modelID=qwen3.8:27b session.id=ses_f940200b5ffe7bp9m3CgOvI9FU small=false agent=explore mode=subagent
timestamp=2026-09-04T10:38:01.250Z level=INFO run=0063006d message="llm runtime selected" llm.runtime=ai-sdk llm.provider=ollama llm.model=qwen3.8:27b
timestamp=2026-09-04T10:38:01.329Z level=ERROR run=0063006d message="stream error" providerID=ollama modelID=qwen3.8:27b session.id=ses_f940200b5ffe7bp9m3CgOvI9FU small=false agent=explore mode=subagent error.error="AI_APICallError: no user query found in messages"
timestamp=2026-09-04T10:38:05.630Z level=INFO run=0063006d message=stream providerID=ollama modelID=qwen3.8:27b session.id=ses_f940200b5ffe7bp9m3CgOvI9FU small=false agent=explore mode=subagent
timestamp=2026-09-04T10:38:05.631Z level=INFO run=0063006d message="llm runtime selected" llm.runtime=ai-sdk llm.provider=ollama llm.model=qwen3.8:27b
timestamp=2026-09-04T10:38:05.706Z level=ERROR run=0063006d message="stream error" providerID=ollama modelID=qwen3.8:27b session.id=ses_f940200b5ffe7bp9m3CgOvI9FU small=false agent=explore mode=subagent error.error="AI_APICallError: no user query found in messages"
timestamp=2026-09-04T10:38:15.469Z level=INFO run=0063006d message=stream providerID=ollama modelID=qwen3.8:27b session.id=ses_f940200b5ffe7bp9m3CgOvI9FU small=false agent=explore mode=subagent
timestamp=2026-09-04T10:38:15.477Z level=INFO run=0063006d message="llm runtime selected" llm.runtime=ai-sdk llm.provider=ollama llm.model=qwen3.8:27b
timestamp=2026-09-04T10:38:15.554Z level=ERROR run=0063006d message="stream error" providerID=ollama modelID=qwen3.8:27b session.id=ses_f940200b5ffe7bp9m3CgOvI9FU small=false agent=explore mode=subagent error.error="AI_APICallError: no user query found in messages"
timestamp=2026-09-04T10:38:31.776Z level=INFO run=0063006d message=stream providerID=ollama modelID=qwen3.8:27b session.id=ses_f940200b5ffe7bp9m3CgOvI9FU small=false agent=explore mode=subagent
Operating System
Windows 11
Terminal
Powershell
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.