ollama integration no results returned #2164

Closed
opened 2026-02-16 17:34:28 -05:00 by yindo · 10 comments
Owner

Originally created by @delphijc on GitHub (Oct 18, 2025).

Originally assigned to: @rekram1-node on GitHub.

Having tried a number of different Ollama models all result in no output and an eventual time out.

I have this issue only in opencode all the models work and respond almost immediately either in the terminal or the Ollama UI.

Same short prompt: what is in this directory?

Answer s/b: the directory is empty. as it is a new project.

Result is: timeout

opencode.json is:{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama (local)",
      "options": {
        "baseURL": "http://localhost:11434/v1"
      },
      "models": {
        "llama3.1:8b": {
          "name": "llama3.1"
        },
        "llama3.2:3b": {
          "name": "llama3.2"
        },
        "qwen2.5-coder:7b": {
          "name": "qwen coder"
        },
        "mistral:7b-instruct": {
          "name": "mistral"
        }
      }
    }
  }
}
Originally created by @delphijc on GitHub (Oct 18, 2025). Originally assigned to: @rekram1-node on GitHub. Having tried a number of different Ollama models all result in no output and an eventual time out. I have this issue only in opencode all the models work and respond almost immediately either in the terminal or the Ollama UI. Same short prompt: what is in this directory? Answer s/b: the directory is empty. as it is a new project. Result is: timeout ``` opencode.json is:{ "$schema": "https://opencode.ai/config.json", "provider": { "ollama": { "npm": "@ai-sdk/openai-compatible", "name": "Ollama (local)", "options": { "baseURL": "http://localhost:11434/v1" }, "models": { "llama3.1:8b": { "name": "llama3.1" }, "llama3.2:3b": { "name": "llama3.2" }, "qwen2.5-coder:7b": { "name": "qwen coder" }, "mistral:7b-instruct": { "name": "mistral" } } } } } ```
yindo closed this issue 2026-02-16 17:34:28 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 18, 2025):

This issue might be a duplicate of existing issues. Please check:

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.

@github-actions[bot] commented on GitHub (Oct 18, 2025): This issue might be a duplicate of existing issues. Please check: - #2865: [Timeout then tool errors with Devstral-Medium](https://github.com/sst/opencode/issues/2865) - Similar timeout issues with Ollama models, specifically mentions "Timeout error" with editing operations - #2985: [Bash tool does not show time out to model or user, model might set time out incorrectly](https://github.com/sst/opencode/issues/2985) - Discusses timeout behavior and how timeouts are not properly communicated to the model - #1721: [bash tool often times out](https://github.com/sst/opencode/issues/1721) - Reports frequent timeout issues with bash tool operations - #2974: [Timeout not working for Local LLM with MLX Models](https://github.com/sst/opencode/issues/2974) - Specifically about timeout settings being ignored for local LLM providers - #2137: [Message generation interrupted, stuck at `Generating`](https://github.com/sst/opencode/issues/2137) - Similar behavior with responses getting stuck or interrupted with local models - #729: [Opencode in linux cannot access tools or create files](https://github.com/sst/opencode/issues/729) - Reports similar "no access to files" issues with local models like Devstral/Ollama 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.
Author
Owner

@delphijc commented on GitHub (Oct 18, 2025):

issue #2137 is similar to what I am experiencing. It is not exactly the same but similar.

@delphijc commented on GitHub (Oct 18, 2025): issue #2137 is similar to what I am experiencing. It is not exactly the same but similar.
Author
Owner

@rekram1-node commented on GitHub (Oct 19, 2025):

I have this issue only in opencode all the models work and respond almost immediately either in the terminal or the Ollama UI.

so like if you curl you get a response instantly?

Maybe you can do:

opencode run hello --print-logs

@rekram1-node commented on GitHub (Oct 19, 2025): > I have this issue only in opencode all the models work and respond almost immediately either in the terminal or the Ollama UI. so like if you curl you get a response instantly? Maybe you can do: opencode run hello --print-logs
Author
Owner

@delphijc commented on GitHub (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

@delphijc commented on GitHub (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](https://github.com/user-attachments/files/22990552/ollama.logs.out.2.txt) [opencode.logs.out.2.txt](https://github.com/user-attachments/files/22990553/opencode.logs.out.2.txt)
Author
Owner

@rekram1-node commented on GitHub (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):

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama (local)",
      "options": {
        "baseURL": "http://localhost:11434/v1",
        "timeout": 600000
      },
      "models": {
        "llama3.1:8b": {
          "name": "llama3.1"
        },
        "llama3.2:3b": {
          "name": "llama3.2"
        },
        "qwen2.5-coder:7b": {
          "name": "qwen coder"
        },
        "mistral:7b-instruct": {
          "name": "mistral"
        }
      }
    }
  }
}
@rekram1-node commented on GitHub (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): ``` { "$schema": "https://opencode.ai/config.json", "provider": { "ollama": { "npm": "@ai-sdk/openai-compatible", "name": "Ollama (local)", "options": { "baseURL": "http://localhost:11434/v1", "timeout": 600000 }, "models": { "llama3.1:8b": { "name": "llama3.1" }, "llama3.2:3b": { "name": "llama3.2" }, "qwen2.5-coder:7b": { "name": "qwen coder" }, "mistral:7b-instruct": { "name": "mistral" } } } } } ```
Author
Owner

@sylvain-billie commented on GitHub (Oct 20, 2025):

you need to change the context size.

To test:

pkill ollama
OLLAMA_CONTEXT_LENGTH=32000 ollama serve

permanent solution is to add the variable to your plist, or modify the model (with modelfile) to use a bigger context

@sylvain-billie commented on GitHub (Oct 20, 2025): you need to change the context size. To test: ```bash pkill ollama OLLAMA_CONTEXT_LENGTH=32000 ollama serve ``` permanent solution is to add the variable to your plist, or modify the model (with modelfile) to use a bigger context
Author
Owner

@delphijc commented on GitHub (Oct 20, 2025):

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.

On Oct 19, 2025, at 5:28 PM, Aiden Cline @.***> wrote:

rekram1-node
left a comment
(sst/opencode#3265)
https://github.com/sst/opencode/issues/3265#issuecomment-3419971753
@delphijc https://github.com/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):

{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ollama": {
"npm": @.***/openai-compatible",
"name": "Ollama (local)",
"options": {
"baseURL": "http://localhost:11434/v1",
"timeout": 600000
},
"models": {
"llama3.1:8b": {
"name": "llama3.1"
},
"llama3.2:3b": {
"name": "llama3.2"
},
"qwen2.5-coder:7b": {
"name": "qwen coder"
},
"mistral:7b-instruct": {
"name": "mistral"
}
}
}
}
}

Reply to this email directly, view it on GitHub https://github.com/sst/opencode/issues/3265#issuecomment-3419971753, or unsubscribe https://github.com/notifications/unsubscribe-auth/BOK52WGTDA3DPHEWZVDKAL33YP66TAVCNFSM6AAAAACJSC4NYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMJZHE3TCNZVGM.
You are receiving this because you were mentioned.

@delphijc commented on GitHub (Oct 20, 2025): 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. > On Oct 19, 2025, at 5:28 PM, Aiden Cline ***@***.***> wrote: > > > rekram1-node > left a comment > (sst/opencode#3265) > <https://github.com/sst/opencode/issues/3265#issuecomment-3419971753> > @delphijc <https://github.com/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): > > { > "$schema": "https://opencode.ai/config.json", > "provider": { > "ollama": { > "npm": ***@***.***/openai-compatible", > "name": "Ollama (local)", > "options": { > "baseURL": "http://localhost:11434/v1", > "timeout": 600000 > }, > "models": { > "llama3.1:8b": { > "name": "llama3.1" > }, > "llama3.2:3b": { > "name": "llama3.2" > }, > "qwen2.5-coder:7b": { > "name": "qwen coder" > }, > "mistral:7b-instruct": { > "name": "mistral" > } > } > } > } > } > — > Reply to this email directly, view it on GitHub <https://github.com/sst/opencode/issues/3265#issuecomment-3419971753>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BOK52WGTDA3DPHEWZVDKAL33YP66TAVCNFSM6AAAAACJSC4NYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMJZHE3TCNZVGM>. > You are receiving this because you were mentioned. >
Author
Owner

@seefood commented on GitHub (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 ps shows nothing is using it.

I assume that means OpenCode is just not really ready for Ollama yet.

@seefood commented on GitHub (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 ps` shows nothing is using it. I assume that means OpenCode is just not really ready for Ollama yet.
Author
Owner

@delphijc commented on GitHub (Oct 21, 2025):

A few things may help:

  1. Make sure the model you want to use has a "tools" tag or it won't work.
  2. In your opencode.json add a "timeout": 600000 tonthe options section after "baseurl": url,
  3. 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

@delphijc commented on GitHub (Oct 21, 2025): A few things may help: 1) Make sure the model you want to use has a "tools" tag or it won't work. 2) In your opencode.json add a "timeout": 600000 tonthe options section after "baseurl": url, 3) 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
Author
Owner

@rekram1-node commented on GitHub (Oct 21, 2025):

lmk if yall run into any issues and if there is anytbung we should change / document better

@rekram1-node commented on GitHub (Oct 21, 2025): lmk if yall run into any issues and if there is anytbung we should change / document better
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2164