Models provided via ollama always respond that are read-only #1560

Open
opened 2026-02-16 17:31:32 -05:00 by yindo · 13 comments
Owner

Originally created by @WJKPK on GitHub (Sep 1, 2025).

Originally assigned to: @thdxr on GitHub.

I'm using following versions of opencode and ollama

$ opencode --version
0.5.28
$ ollama --version
ollama version is 0.11.4

Here is my config.

Image

It look similar for both - devstral & gpt-oss models. If i try to generate /init it also fails in similar way. Last message from screenshot is from grok and this agent is working properly. Messages about read-only mode are independent from mode chosen in TUI (plan/build/review).

How can I provide you more verbose information to help?

Originally created by @WJKPK on GitHub (Sep 1, 2025). Originally assigned to: @thdxr on GitHub. I'm using following versions of opencode and ollama ``` $ opencode --version 0.5.28 $ ollama --version ollama version is 0.11.4 ``` Here is my [config](https://github.com/WJKPK/lavix/blob/main/opencode.nix). <img width="1676" height="1049" alt="Image" src="https://github.com/user-attachments/assets/e3310c1b-8dc3-48c1-8026-15eab9930746" /> It look similar for both - devstral & gpt-oss models. If i try to generate /init it also fails in similar way. Last message from screenshot is from grok and this agent is working properly. Messages about read-only mode are independent from mode chosen in TUI (plan/build/review). How can I provide you more verbose information to help?
Author
Owner

@github-actions[bot] commented on GitHub (Sep 1, 2025):

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

  • #1034: Local Ollama tool calling either not calling or failing outright - describes similar issues where Ollama models generate tool calls but they are not executed, instead appearing as plain text
  • #590: not being able to write files when using local models - reports that Ollama models generate tool call JSON but files are not actually written
  • #1068: Tool use with Ollama models - shows tool call executions being aborted with Ollama models, similar behavior to your read-only responses

These issues all describe similar symptoms where Ollama models appear to generate tool calls but they don't execute properly, which could manifest as the "read-only" behavior you're experiencing.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Sep 1, 2025): This issue might be a duplicate of existing issues. Please check: - #1034: Local Ollama tool calling either not calling or failing outright - describes similar issues where Ollama models generate tool calls but they are not executed, instead appearing as plain text - #590: not being able to write files when using local models - reports that Ollama models generate tool call JSON but files are not actually written - #1068: Tool use with Ollama models - shows tool call executions being aborted with Ollama models, similar behavior to your read-only responses These issues all describe similar symptoms where Ollama models appear to generate tool calls but they don't execute properly, which could manifest as the "read-only" behavior you're experiencing. Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Sep 1, 2025):

Hm you may need to set "tool_call": true in your opencode.json, can you share yours by chance?

ex:

"provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama (local)",
      "options": {
        "baseURL": "http://localhost:11434/v1"
      },
      "models": {
        "llama2": {
          "name": "Llama 2",
          "tool_call": true
        }
      }
    }
  }
@rekram1-node commented on GitHub (Sep 1, 2025): Hm you may need to set `"tool_call": true` in your opencode.json, can you share yours by chance? ex: ``` "provider": { "ollama": { "npm": "@ai-sdk/openai-compatible", "name": "Ollama (local)", "options": { "baseURL": "http://localhost:11434/v1" }, "models": { "llama2": { "name": "Llama 2", "tool_call": true } } } } ```
Author
Owner

@WJKPK commented on GitHub (Sep 2, 2025):

I already added my config. Add tool_call helped, but models now have problems with tool calling.

Image

Should we continue here, or should I create new issue?

@WJKPK commented on GitHub (Sep 2, 2025): I already added my [config](https://github.com/WJKPK/lavix/blob/main/opencode.nix). Add tool_call helped, but models now have problems with tool calling. <img width="1692" height="1326" alt="Image" src="https://github.com/user-attachments/assets/bde68992-330e-4f85-8b20-de7341b728d6" /> Should we continue here, or should I create new issue?
Author
Owner

@rekram1-node commented on GitHub (Sep 2, 2025):

you may have to prompt for that, most models don't have that issue and you are using a pretty small model there

@rekram1-node commented on GitHub (Sep 2, 2025): you may have to prompt for that, most models don't have that issue and you are using a pretty small model there
Author
Owner

@WJKPK commented on GitHub (Sep 2, 2025):

I tried prompting, I tried fixes from https://github.com/sst/opencode/issues/1068 - it doesn't work. I need a tool that works well with local models. Sincere thanks for the open source tool, but my use case is not really supported.

@WJKPK commented on GitHub (Sep 2, 2025): I tried prompting, I tried fixes from https://github.com/sst/opencode/issues/1068 - it doesn't work. I need a tool that works well with local models. Sincere thanks for the open source tool, but my use case is not **really** supported.
Author
Owner

@rekram1-node commented on GitHub (Sep 2, 2025):

I have heard people get 20b working so I will try to get back to you on if they did anything special

@rekram1-node commented on GitHub (Sep 2, 2025): I have heard people get 20b working so I will try to get back to you on if they did anything special
Author
Owner

@rekram1-node commented on GitHub (Sep 2, 2025):

Can you set OLLAMA_CONTEXT_LENGTH=12288 I heard some people say ollama basically doesnt work without it in many cases

@rekram1-node commented on GitHub (Sep 2, 2025): Can you set `OLLAMA_CONTEXT_LENGTH=12288` I heard some people say ollama basically doesnt work without it in many cases
Author
Owner

@johnjelinek commented on GitHub (Sep 2, 2025):

note: you may need to tweak the context based on your available memory. 8192 is a good starting point and then increment by 1024 until you get something that works (or memory runs out).

@johnjelinek commented on GitHub (Sep 2, 2025): note: you may need to tweak the context based on your available memory. `8192` is a good starting point and then increment by `1024` until you get something that works (or memory runs out).
Author
Owner

@rekram1-node commented on GitHub (Sep 2, 2025):

thank you @johnjelinek for jumping in!

@rekram1-node commented on GitHub (Sep 2, 2025): thank you @johnjelinek for jumping in!
Author
Owner

@WJKPK commented on GitHub (Sep 3, 2025):

Hmm, great! After set up of this variable it started working with gpt-oss.
As I am a Nix user, for those interested, here is my ollama with nvidia GPU declaration.

  services = {
    ollama = {
      enable = true;
      package = pkgs.ollama-cuda;
      acceleration = "cuda";
      environmentVariables = {
        OLLAMA_CONTEXT_LENGTH = "16384";
      };
    };
Image
@WJKPK commented on GitHub (Sep 3, 2025): Hmm, great! After set up of this variable it started working with gpt-oss. As I am a Nix user, for those interested, here is my ollama with nvidia GPU declaration. ``` services = { ollama = { enable = true; package = pkgs.ollama-cuda; acceleration = "cuda"; environmentVariables = { OLLAMA_CONTEXT_LENGTH = "16384"; }; }; ``` <img width="1647" height="1172" alt="Image" src="https://github.com/user-attachments/assets/f997176b-52f2-4b6c-8996-5239564e12cc" />
Author
Owner

@rekram1-node commented on GitHub (Sep 3, 2025):

thank you both of you I will try to point people here if they encounter ollama issues local inference issues

@rekram1-node commented on GitHub (Sep 3, 2025): thank you both of you I will try to point people here if they encounter ~~ollama issues~~ local inference issues
Author
Owner

@johnjelinek commented on GitHub (Sep 3, 2025):

I think this mustn't be unique to ollama. I'd be surprised if you didn't have to set the context window likewise in llama-server

@johnjelinek commented on GitHub (Sep 3, 2025): I think this mustn't be unique to `ollama`. I'd be surprised if you didn't have to set the context window likewise in `llama-server`
Author
Owner

@MarvAmBass commented on GitHub (Oct 31, 2025):

thanks so much OLLAMA_CONTEXT_LENGTH=12288 fixed the issue on my machine

@MarvAmBass commented on GitHub (Oct 31, 2025): thanks so much `OLLAMA_CONTEXT_LENGTH=12288` fixed the issue on my machine
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1560