Skip to content

read_file tool call not available with local model gemma4:e4b running with Ollama #21354

Closed as not planned

Description

@bhargodevarya

Question

I am running opencode with locally running gemma4:e4b with Ollama. I tried to ask it to read a file and it was not able to. It gave the message I am attaching as an image to this. The read tool from openCode is not used since the model looks for read_file tool. When I switch to openAI's API call after giving my token, it starts to work. Is there a separate config needed for LLMs running on local with Ollama to resolve tools calls?

Image

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 7, 2026
  2. github-actions commented on Apr 7, 2026

    @github-actions
    Contributor

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

    These issues describe the same underlying problem: gemma4 tool calling not working correctly through OpenCode's Ollama integration. Please check if any of these cover your case and consider adding your findings there instead.

  3. justfortheloveof commented on Apr 7, 2026

    @justfortheloveof
    Contributor

    You perhaps need to increase the context window in your Ollama settings (that's my assumption as it is saying it didn't get any user query but only a list of tools which was probably incomplete due to the small context window).

    Once that is done, you'll need a stronger model to get anything done and perhaps use something else than Ollama.

  4. BrutchsamaJeanLouis commented on Apr 10, 2026

    @BrutchsamaJeanLouis

    there is also issue 16531 that blocks gemma4 support

  5. leonelmorenoa commented on Apr 13, 2026

    @leonelmorenoa

    Any solution for this issue?

  6. leonelmorenoa commented on Apr 13, 2026

    @leonelmorenoa

    @rekram1-node Hi, please, I also have this issue, any idea? I am using a Macbook Pro M4 base + gemma4:e4b, Ollama, I have the exact same error resposne

  7. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  8. srggrs commented on May 20, 2026

    @srggrs

    I have the same issue with Gemma4 E4B IT with a context window of 32k running with llama.cpp. Can share this "thinking" output from within Opencode

    Steps:
      ┃  1. Read config.yml.
      ┃  2. Analyze the file contents, specifically around lines 24 and 33, to identify how the cluster/environment settings are missing or
      ┃  misconfigured.
      ┃  3. Formulate a plan and/or ask the user for clarification based on the findings.
      ┃
      ┃  I will start by reading the file.
    
         [read]:config.yml
  9. rkuo2000 commented on May 31, 2026

    @rkuo2000

    use journalctl -u ollama -f to see if prompt > num_ctx
    model's num_ctx (context window size) can be checked by running ollama ps

    How to fix :
    ollama run gemma4-31b

    /set parameter num_ctx 65536
    /save gemma4-31b-ctx64k
    /exit

    edit ~/.config/opencode/opencode.json to rename model to the newly saved model (gemma4-31b-ctx64k)
    rerun opencode

  10. rekram1-node commented on Jun 23, 2026

    @rekram1-node
    Contributor

    Automated: closing question issues.

    GitHub Issues are for bug reports and feature requests only — questions / support are no longer tracked here.

    If this is a bug or feature request, please open a new issue with the appropriate template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions