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
The core issue appears to be timeout-related problems with Ollama integration where models work fine outside opencode but fail to return responses when used through opencode.
Feel free to ignore if none of these address your specific case.
Thank you for looking into this I have run several tests today. Attached are txt based log files for opencode and ollama server outputs of the tests. In each case I first run "ollama serve > ollama.out.logs 2>&1", then in a separate terminal "ollama ps" to verify no model is loaded, the "ollama run qwen2.5-coder:7b" prompt with hello or sup bro get a response of hello how can I help, then "ollama ps" again to verify the model is running, then "opencode run hello > opencode.logs.out 2>1&" to capture opencode logs. I tried this both with and without starting ollama run qwen2.5-coder:7b, each time with fresh runs of "ollama serve" from cold starts.
all results ended with very limited or not calls to the /v1 api in ollama serve logs and opencode logs end in timeout.
I admit to being in relative noob status so if I am overlooking something totally obvious please let me know.
Thank you adding the timeout and a OLLAMA_CONTEXT_LENGTH has this working with qwen2.5-coder:7b on my MacBook. I will try it again on my Mac mini with this same configuration to clear the issue if it also works there. Same amount of unified memory in each but Mac mini is Intel based maybe just too slow.
I have the same issue. when I select a local ollama model I either get an immediate error "AI_APICallError: Forbidden" or "AI_APICallError: registry.ollama.ai/library/deepseek-coder-v2:16b does not support tools" (same for startcoder of all versions), but if I use llama or QWEN it just animates the "Generating" and does nothing - I know because ollama ps shows nothing is using it.
I assume that means OpenCode is just not really ready for Ollama yet.
Make sure the model you want to use has a "tools" tag or it won't work.
In your opencode.json add a "timeout": 600000 tonthe options section after "baseurl": url,
increase the context size to at least 32000. export OLLAMA_CONTEXT_LENGTH=32000, and then start ollama serve.
These got me to the point where I was receiving results. I have not gotten to the point where I am being productive yet. Maybe after $dayjob this evening. Good luck! #noobsunite
Activity
github-actions commentedon Oct 18, 2025
This issue might be a duplicate of existing issues. Please check:
Generating#2137: Message generation interrupted, stuck atGenerating- Similar behavior with responses getting stuck or interrupted with local modelsThe core issue appears to be timeout-related problems with Ollama integration where models work fine outside opencode but fail to return responses when used through opencode.
Feel free to ignore if none of these address your specific case.
delphijc commentedon Oct 18, 2025
issue #2137 is similar to what I am experiencing. It is not exactly the same but similar.
rekram1-node commentedon Oct 19, 2025
so like if you curl you get a response instantly?
Maybe you can do:
opencode run hello --print-logs
delphijc commentedon Oct 19, 2025
Thank you for looking into this I have run several tests today. Attached are txt based log files for opencode and ollama server outputs of the tests. In each case I first run "ollama serve > ollama.out.logs 2>&1", then in a separate terminal "ollama ps" to verify no model is loaded, the "ollama run qwen2.5-coder:7b" prompt with hello or sup bro get a response of hello how can I help, then "ollama ps" again to verify the model is running, then "opencode run hello > opencode.logs.out 2>1&" to capture opencode logs. I tried this both with and without starting ollama run qwen2.5-coder:7b, each time with fresh runs of "ollama serve" from cold starts.
all results ended with very limited or not calls to the /v1 api in ollama serve logs and opencode logs end in timeout.
I admit to being in relative noob status so if I am overlooking something totally obvious please let me know.
ollama.logs.out.2.txt
opencode.logs.out.2.txt
rekram1-node commentedon Oct 19, 2025
@delphijc the only thing I can think of is increasing your timeout?
You can set a custom timeout like so (this is a 10 minute one):
sylvain-billie commentedon Oct 20, 2025
you need to change the context size.
To test:
permanent solution is to add the variable to your plist, or modify the model (with modelfile) to use a bigger context
delphijc commentedon Oct 21, 2025
seefood commentedon Oct 21, 2025
I have the same issue. when I select a local ollama model I either get an immediate error "AI_APICallError: Forbidden" or "AI_APICallError: registry.ollama.ai/library/deepseek-coder-v2:16b does not support tools" (same for startcoder of all versions), but if I use llama or QWEN it just animates the "Generating" and does nothing - I know because
ollama psshows nothing is using it.I assume that means OpenCode is just not really ready for Ollama yet.
delphijc commentedon Oct 21, 2025
A few things may help:
These got me to the point where I was receiving results. I have not gotten to the point where I am being productive yet. Maybe after $dayjob this evening. Good luck! #noobsunite
rekram1-node commentedon Oct 21, 2025
lmk if yall run into any issues and if there is anytbung we should change / document better