Skip to content

Ollama (qwen2.5-coder): tool calls (edit/write) show as executed but no files are created/modified #7030

Closed as not planned

Description

@danielveraec

Description

When using OpenCode with Ollama + qwen2.5-coder, tool calls such as edit / write appear to execute (the JSON tool payload is printed in the output), but no files are actually created or modified on disk.

This affects both /init (which does not create AGENTS.md) and any manual request to create or edit files. Manual file creation using the shell works, confirming the directory is writable. The issue reproduces consistently across sessions and directories.

It appears that tool calls are generated by the model, but are not applied to the filesystem.

Plugins

No response

OpenCode version

1.1.3

Steps to reproduce

  1. cd into a writable directory (verified with touch test.txt)
  2. Start OpenCode from that directory:
    opencode
  3. Ask OpenCode to create a file, for example:
    "Create a file named prueba.txt"
  4. Alternatively, run:
    /init
  5. OpenCode prints a tool call (edit / write), but no file is created on disk.

Screenshot and/or share link

Image

Operating System

macOS 26.2 (Tahoe)

Terminal

macOS Terminal (zsh)

Activity

  1. github-actions commented on Jan 6, 2026

    @github-actions
    Contributor

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

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

  2. rekram1-node commented on Jan 6, 2026

    @rekram1-node
    Contributor

    Is this w/ ollama?

  3. danielveraec commented on Jan 6, 2026

    @danielveraec
    Author

    Is this w/ ollama?

    Yes. This is using Ollama (local) with qwen2.5-coder via the OpenAI-compatible endpoint (http://127.0.0.1:11434/v1). The issue reproduces consistently when using Ollama as the provider.

  4. rekram1-node commented on Jan 6, 2026

    @rekram1-node
    Contributor

    Did u set num_ctx (see docs)

    Ill try to do a pass on ollama soon but rn u need to configure that cause ollama by default has such a low context limit that agentic stuff will hardly work

  5. GlenM42 commented on Jan 6, 2026

    @GlenM42

    Same problem. Increasing the context size in the Ollama settings appears to solve the issue:

    Image

    UPD. Sorry for misleading. Worked once, but can't make it to work since

  6. dwhacks commented on Jan 29, 2026

    @dwhacks

    Even making qwen2.5-coder have a 20k or more context length it doesnt seem to be able to actually create/edit files:

    create a python script that will convert user input text into sha-256 checksum

    echo -n "Enter the text to convert: "
    read text
    echo -ne "$text" | openssl dgst -sha256

    This script prompts the user for text input and then uses openssl to compute the SHA-256 checksum of the provided text.

    It writes out the steps as if its doing it, but doesnt do it. Qwen3 will work with all the same settings.

  7. torgeir commented on Feb 8, 2026

    @torgeir

    I'm seeing the same thing.

  8. allarac commented on Feb 13, 2026

    @allarac

    Ask the model what the function signature of the write tool is. It will tell you garbage like filepath followed description, while it is content followed by filepath. If you explain it, it does it correctly, keeps forgetting.

  9. Stolz commented on Feb 20, 2026

    @Stolz

    I'm having the same issue with my qwen2.5 models hosted in local Docker Ollama. Ollama context is set to 32K (env var OLLAMA_CONTEXT_LENGTH=32768) and verified via Open WebUI.

    If I select qwen2.5-coder:14b-instruct-q4_K_M model in build agent and ask what is the function signature of the write tool? I get

         The write tool function signature is as follows:
    
         {
           name: write,
           arguments: {
             filePath: /path/to/file,
             content: Content to write into the file
           }
         }
    
         - filePath (string): The absolute path where the file should be created or overwritten.
         - content (string): The content to write into the specified file.
    
         When you call this tool with the appropriate arguments, it will create or overwrite the file at the provided filePath with the specified  content.
    

    The Ollama logs don't show any error nor warning

  10. currymike123 commented on Feb 23, 2026

    @currymike123

    I'm having the same issue with Ollama and OpenCode running qwen2.5-coder:14b-instruct with a 32k context window. Any suggestions?

  11. Stolz commented on Feb 24, 2026

    @Stolz

    After my issues with Ollama I just installed Llama.cpp and I can reproduce the same issue. So the problem seems to be either OpenCode, either the qwen2.5 models.

  12. aburlot commented on Mar 4, 2026

    @aburlot

    Having the same issue with qwen2.5-coder:latest on ollama, but it worked with devstral-small-2:latest. So my 2 cents are on the model.

  13. lawrenehi commented on Mar 18, 2026

    @lawrenehi

    having the same issue with llama.cpp, only qwen3 works, deepseek just says i dont have permission and qwen2.5 acts as above.

  14. davidrudlstorfer commented on Mar 31, 2026

    @davidrudlstorfer

    @danielveraec I am experiencing exactly the same behaviour, have you found any solution to that?

  15. Nightro commented on Apr 9, 2026

    @Nightro

    Same thing over here!

  16. nilo85 commented on Apr 16, 2026

    @nilo85

    I have the same behaviour

  17. adlbgr commented on Apr 17, 2026

    @adlbgr

    me either :( any solutionS?

  18. the-webguys commented on Apr 19, 2026

    @the-webguys

    At the risk of getting your hopes up, I have been working on this for a while and a workaround MAY be imminent...

    Just some final testing and i shall post it publicly for everyone, as a few are also struggling with IDE -> llama-server issues and tools

    I successfully got a test for File creation when setting (in: opencode.jsonc ):

    "permission": {
        "edit": "allow",
        "bash": "deny",
        "write": "allow"
      },
    

    and then,

    "permission": {
        "edit": "ask",
        "bash": "deny",
        "write": "ask"
      },
    

    This produced: ALLOW or DENY options.
    Image of the first success...

    I'm NOT jumping around my living room, YOU ARE!

    Image
  19. the-webguys commented on Apr 22, 2026

    @the-webguys

    I finally got time to finalise and publish the Repo...

    If anyone is still having issues with Tools NOT communicating, Check out the tool i made to help with this Exact issue, i would love some feedback...

    https://github.com/the-webguys/llama-BridgeAI

  20. jdjinete commented on May 2, 2026

    @jdjinete

    I managed to completely solve this issue when using local models via Ollama (like Qwen, Phi-4, or GPT-OSS) in my WSL/VS Code setup.

    The Problem:
    Local OSS models often lack the strict structural obedience to use the file_editor tool correctly unless explicitly forced via a strong SYSTEM prompt. Just pulling the base model and setting "tools": true in the config is usually not enough; they either hallucinate the tool name or output plain text instead of triggering the actual tool execution.

    The Solution:
    Here is the step-by-step guide to fixing it by creating a custom "Agent" model in Ollama:

    Step 1: Create a Master Agent Modelfile

    Create a file named MasterAgent.mf in your terminal. This prompt forces the model to respect the tool schema provided by OpenCode, stops laziness, and optimizes the context window.

    # Context window (adjust based on your RAM/VRAM)
    PARAMETER num_ctx 16384
    PARAMETER temperature 0.2
    PARAMETER top_p 0.9
    PARAMETER top_k 40
    
    SYSTEM """
    You are an elite Senior Software Engineer and AI Assistant. 
    Your primary goal is to provide highly capable, accurate, and complete programming assistance.
    
    # TOOL USAGE & ENVIRONMENT
    You have access to environment-provided tools to read files, write files, and execute commands.
    - ALWAYS use the exact tool schemas and formats explicitly provided by your current environment (e.g., OpenCode, VS Code, or Cline).
    - Do not invent or hallucinate tool names. 
    - All file paths should be relative to the current active workspace directory, unless an absolute path is requested.
    - When asked to modify or create a file, execute the tool call immediately. Do not just explain how to do it in plain text.
    
    # CODING STANDARDS
    - Write clean, production-ready, modular, and well-documented code.
    - NO LAZINESS: Never output incomplete code, avoid placeholders like '... (rest of the code)'. Always write the full modified block or file.
    - Before making complex architectural changes, briefly output a 'thinking' process to plan your steps, then execute the necessary tools.
    """

    Step 2: Compile the Custom Agent Model

    Combine your base model (e.g., Qwen 2.5 Coder or Phi-4) with this new Modelfile. Run this in your terminal:

    # 1. Pull your preferred base model
    ollama pull qwen2.5-coder:14b
    
    # 2. Create a specific Modelfile for it
    echo "FROM qwen2.5-coder:14b" > Modelfile-qwen
    cat MasterAgent.mf >> Modelfile-qwen
    
    # 3. Compile the new tool-enabled agent
    ollama create qwen-agent -f Modelfile-qwen

    Step 3: Update opencode.json

    Now, map this newly created qwen-agent in your OpenCode configuration file (usually located at ~/.config/opencode/opencode.json). Make sure to use the @ai-sdk/openai-compatible provider and explicitly set "tools": true.

    {
      "$schema": "[https://opencode.ai/config.json](https://opencode.ai/config.json)",
      "provider": {
        "ollama": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Ollama local",
          "options": {
            "baseURL": "http://localhost:11434/v1"
          },
          "models": {
            "qwen-agent": {
              "name": "Qwen 14B Agent",
              "tools": true
            }
          }
        }
      }
    }

    Step 4: Restart

    Restart your OpenCode session. The model should now reliably use the file_editor tool, generate the "Thinking" blocks, and apply file patches successfully without throwing the "Skill 'file_editor' not found" error.

    (Note: You can apply this exact same fix to phi4, gpt-oss, or any other reliable coding model by changing the base model in Step 2).

    Hope this helps anyone struggling with local setups! 🚀

  21. torgeir commented on May 2, 2026

    @torgeir

    Followed steps as described, this did not work for me @jdjinete

    Image
  22. removed
    bugSomething isn't working
    on May 3, 2026
  23. Jaydonchong commented on May 7, 2026

    @Jaydonchong

    Followed this instruction and managed to get my qwen2.5-coder:3b to create a simple file, however when prompted to create multiple files, it somehow insists on printing instructions rather than creating actual files

  24. github-actions commented on Jul 8, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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