Repository navigation
Open
Labels
area/cliCommands and flagsCommands and flagsplatform/windowsWindowsWindowstype/bugSomething is brokenSomething is brokenversion/v2OpenCode 2.xOpenCode 2.x
Description
Summary
opencode run with the default local Ollama model produces no output and never exits. The same CLI completes normally with an HTTP-compatible remote model, and Ollama's own API answers the same prompt in seconds.
Environment
- opencode version: 1.18.31 (
opencode --version; executable resolved through%APPDATA%\npm\opencode.ps1). OpenCode Desktop 2.3.2 is also installed but its CLI is not the one onPATH. - OS: Microsoft Windows NT 10.0.26300.0 (Windows 11 x64).
veris unavailable in PowerShell, so[Environment]::OSVersion.VersionStringwas used. - Terminal:
TERM=xterm-256color;TERM_PROGRAM,COLORTERM, andWT_SESSIONunset. Command was launched from the OpenCode shell tool (non-interactive). - Shell:
%COMSPEC%=C:\WINDOWS\system32\cmd.exe; OpenCode config sets"shell": "powershell"for its own shell tool. - Install/channel: npm global install, release channel (
C:\Users\<user>\AppData\Roaming\npm\opencode.ps1). - Active plugins: None found. No
pluginskey in~/.config/opencode/opencode.jsonoropencode.jsonc; no.opencode/plugin,.opencode/plugins,plugin, orpluginsdirectories under the global config directory.
Reproduction
- Install Ollama 0.40.16 and pull
qwen2.5-coder:7b(4.7 GB). Runollama servewithOLLAMA_HOST=127.0.0.1:11434; confirmGET http://127.0.0.1:11434/api/tagsreturns 200. - In the global config, the resolved default model is
ollama/qwen2.5-coder:7b(opencode debug configconfirms this). - Run
opencode run "Reply with exactly: LOCAL_OK"from any directory. - Wait several minutes. No output is produced and the prompt never returns.
- Control A: direct
POST http://127.0.0.1:11434/api/generatewith{"model":"qwen2.5-coder:7b","prompt":"Say OK","stream":false,"options":{"num_predict":8}}returns HTTP 200, body{"response":"OK"}, in about 19 seconds. - Control B:
opencode run -m freellmapi/nemotron-3-ultra-550b "Reply with exactly: SAFE_OK"printsSAFE_OKand exits normally.
Expected Behavior
opencode run should print the model's reply and exit, or surface a clear timeout/connection error if the model cannot be reached.
Actual Behavior
The process stayed alive for about 8 minutes with no stdout and no error. Get-Process showed the opencode.exe process alive with Responding = True and roughly 22 seconds of cumulative CPU time. The parent shell also stayed alive with no output because the pipeline buffers until the child exits. Both were terminated manually; the shell reported exit code 4294967295.
Additional Context
- Frequency: observed once; not re-run after restarting Ollama.
- Ollama was listening only on
127.0.0.1:11434with an inbound firewall block, so this is not a network reachability problem. - Relevant global config (no credentials shown):
"model": "ollama/qwen2.5-coder:7b",
"provider": {
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"options": { "baseURL": "http://127.0.0.1:11434/v1" },
"models": {
"qwen2.5-coder:7b": { "name": "Qwen2.5 Coder 7B" }
}
}
},
"sandbox": {
"enabled": true,
"image": "langchain/langgraph-sandbox:latest",
"resources": { "cpu": 2, "memory": "4GiB" }
}- Docker Desktop's engine was not running during the failing test (it was started afterwards for an unrelated container audit). If sandbox startup is involved in this hang, that is worth checking; the remote-model control succeeded under the same condition.
- No custom plugins or provider overrides affect this model beyond the config above.
Metadata
Metadata
Assignees
Labels
area/cliCommands and flagsCommands and flagsplatform/windowsWindowsWindowstype/bugSomething is brokenSomething is brokenversion/v2OpenCode 2.xOpenCode 2.x
Activity
opencodejr commentedon Nov 21, 2026
Thanks for the detailed report and the two control tests.
The
opencodeon yourPATHis 1.18.31, which is OpenCode v1 (theopencode-ainpm package). v1 now only gets fixes for critical bugs, such as data loss, security problems or breakage with no workaround. This hang has workarounds, so it's unlikely to be fixed on v1.Please try the same thing on v2:
Then open a new terminal and check that
opencode --versionshows2.x. Other install options are at https://opencode.ai/docs/, and the changes from v1 are described at https://opencode.ai/docs/migrate-v1/. For example, v1 plugins don't run in v2.Related: #56448 was a v2 report (2.0.32, now closed) of a headless server stalling with a local Ollama model on Windows. If v2 behaves the same way for you, that issue may be useful for comparison.
I'm closing this issue now. If it also happens on v2, or if you think this is critical, reply here and the issue will reopen. Please include the v2
opencode --versionand the exact command you ran.TehseenTech commentedon Nov 21, 2026
Reproduced on v2 as well.
opencode --version→opencode v2.3.2(@opencode/cli, channellatest)opencode run "Reply with exactly: LOCAL_OK"(from~/.config/opencode)ollama/qwen2.5-coder:7b(Ollama 0.40.16,127.0.0.1:11434).Additional evidence:
POST /api/generateat 03:47:41 that returned 200 withOKin 19s.~/.local/share/opencode/log/opencode.logrecordscli starting version=2.3.2 channel=latest args=["run","Reply with exactly: LOCAL_OK"]and then nothing — nocreating instance, no session, no model stream.opencode run -m freellmapi/nemotron-3-ultra-550b "..."completes normally withSAFE_OK.This appears different from #56448: that report involved a custom client polling
/api/session//message; here it is the CLI itself and no session is ever created.opencodejr commentedon Nov 21, 2026
Thanks for testing on v2 and for the log details.
I tried to reproduce this on Linux with
@opencode/cli2.3.2 and the config from your report: theollamaprovider via@ai-sdk/openai-compatibleas the default model, plus thesandboxblock with Docker not running. I ranopencode run "Reply with exactly: LOCAL_OK"from~/.config/opencode, with an OpenAI-compatible stand-in for Ollama on127.0.0.1:11434. It printedLOCAL_OKand exited within a second. So the sandbox setting, the default local model and the working directory don't cause the hang by themselves, at least on Linux.Your log points somewhere else. In a working run,
opencode runstarts a local server as a child process. That child writes its owncli starting ... args=["serve","--stdio","--port","0"]line to the same log, followed by its startup messages. Your log stops after therunline, which suggests the child server never starts (or never reports that it's ready) on your Windows setup. The model would never be called in that case, which fits Ollama seeing no request. This looks Windows-specific, so it needs a maintainer with a Windows machine.These would help whoever picks this up:
opencodeprocess (for example inGet-Process opencodeor Task Manager), and what is its command line?$env:OPENCODE_PRINT_LOGS="1"set in PowerShell first, and paste any output.opencode run -m freellmapi/nemotron-3-ultra-550b "..."still finish on 2.3.2? Your earlier remote-model test was with the 1.18.31 CLI.TehseenTech commentedon Nov 21, 2026
Answers to the four checks, all on
opencode v2.3.2(@opencode/cli, installed via npm with scripts enabled):Second process while hanging: no. The only CLI process was
opencode.exe run "Reply with exactly: LOCAL_OK"(PID 21324). There was no childopencode.exe serve --stdio --port 0— the same process tree also contains OpenCode Desktop's ownopencode-cli.exe serve --service, but nothing spawned by thisrun.OPENCODE_PRINT_LOGS=1: the only output wastimestamp=2026-11-21T10:35:51.856Z level=INFO run=68bb182d message="cli starting" version=2.3.2 channel=latest local=false args="[\"run\",\"Reply with exactly: LOCAL_OK\"]" role=cliand then nothing.Normal PowerShell rather than the shell tool: also hangs. I started a separate hidden
powershell.exe -NoProfile -Command '$env:OPENCODE_PRINT_LOGS="1"; opencode run "Reply with exactly: LOCAL_OK" 2>&1'and redirected its stdout/stderr. It was still running after 60s, with the same singlecli startinglog line. (PowerShell's-ArgumentListquoting split the prompt into several argv tokens in this variant, but it still produced no child server.) So the shell tool is not the trigger.Remote model on v2.3.2:
opencode run -m freellmapi/nemotron-3-ultra-550b "Reply with exactly: SAFE_OK"printedSAFE_OKand exited in 12.3s. So the CLI and session machinery do work on this machine; the stall is specific to the local-model/default path and happens before the child server starts.TehseenTech commentedon Nov 21, 2026
Possible lead for whoever picks this up: this may share a root cause with #64686 ("every session method hangs forever on Windows — Bun
fetchstarved by the/global/eventSSE stream"). Our symptom fits that family: the CLI never spawns theserve --stdio --port 0child and no session is ever created, so it stalls before any model call.Related PRs: #64984 and #64994 (
node:httptransport for ACP) were both closed without merge, and #63477 (cli: port to native) is still open — that would remove the Bun runtime from this path entirely.If a build from that PR, or a beta/dev channel build, is available, I'm happy to test
opencode run "Reply with exactly: LOCAL_OK"on Windows 11 with the local Ollama model and report back. I can also provide process listings,OPENCODE_PRINT_LOGS=1output, oropencode.logexcerpts if useful.