r/LocalLLM • • 1h ago

Question OpenCode Desktop hangs indefinitely with Ollama + Qwen 4, despite successful API and tool-calling tests

I'm trying to get Qwen 4 working with OpenCode Desktop on Windows, but OpenCode gets stuck on "Working..." indefinitely, even when I send something as simple as hello.

I'm trying to determine whether this is an OpenCode integration issue, a reasoning/streaming issue, or something else.

My setup

  • Windows 11
  • OpenCode Desktop 2.4.5 (installed via the Windows installer)
  • Ollama 0.40.21
  • Model: qwen4:latest
  • GPU: NVIDIA RTX 4090 (24 GB VRAM)
  • CPU: Intel i9-13900K
  • RAM: 64 GB
  • Requested context: 86k tokens

Ollama reports the following when the model is loaded:

NAME          SIZE    PROCESSOR          CONTEXT
qwen4:latest  37 GB   46%/54% CPU/GPU    131072

What I've already tested

I've spent quite some time isolating the problem, and I've established that Qwen 4 itself works through Ollama.

1. Normal text generation works.

ollama run qwen4:latest "Reply with exactly: hello"

It eventually responds correctly. With --think=low, the response takes approximately 20 seconds.

2. Native Ollama tool calling works.

I sent a direct request to:

http://127.0.0.1:11434/api/chat

Qwen 4 returned a valid structured tool_calls object with the correct function name and arguments.

3. OpenAI-compatible tool calling works.

I also tested:

http://127.0.0.1:11434/v1/chat/completions

With streaming both enabled and disabled.

Both produced valid structured tool calls.

4. Streaming works.

The streaming response included:

  • Reasoning chunks
  • A structured tool_calls event
  • finish_reason: "tool_calls"
  • A final [DONE] event

So far, I haven't been able to reproduce the failure directly through either Ollama API.

The actual problem

When I open OpenCode Desktop, select ollama/qwen4:latest, and send hello, it remains on "Working..." for several minutes without producing an answer.

I also inspected the OpenCode logs. One relevant entry was:

WARN failed to discover Ollama models

baseURL=http://127.0.0.1:11434/v1

cause="HttpClientError: Transport error
(GET http://127.0.0.1:11434/api/tags)
(cause: TypeError: ECONNREFUSED)"

There were also repeated Git worktree discovery warnings, although I don't know whether those are related.

What I'm trying to understand

  1. Could OpenCode 2.4.5 be mishandling Qwen 4's reasoning stream, even though Ollama returns valid reasoning and tool-call events?
  2. Is there a known issue with OpenCode's native Ollama integration and Qwen 4?
  3. Could the model's CPU/GPU offloading and relatively slow generation be causing OpenCode to time out or appear stuck?
  4. Is there a way to inspect the exact request OpenCode sends to Ollama and compare it with my successful API tests?
  5. Are there any recommended OpenCode provider settings specifically for Qwen 4?

I'd particularly appreciate input from anyone running Qwen 4 locally through Ollama and OpenCode Desktop.

I'd prefer to fix the integration rather than switch models or move to a cloud API.

0 Upvotes

1 comment sorted by

1

u/Smungus05 4m ago

I don't know Ollama but anytime i have an issue with opencode i just enter a new session with deepseek free and ask it to diagnose for me.