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
{{ message }}
Repository navigation
Unable to generate files when using local Ollama #29996
OpenCode 1.15.12
I self-hosted Ollama locally using Docker and installed the gemma4 model. I also configured the Ollama provider in OpenCode under C:\Users<UserName>.config\opencode. { "$schema": "https://opencode.ai/config.json", "plugin": ["opencode-antigravity-auth@latest"], "provider": { "ollama": { "npm": "@ai-sdk/openai-compatible", "name": "Ollama (local)", "options": { "baseURL": "http://localhost:11434/v1" }, "models": { "gemma4:26b": { "name": "gemma4:26b" }, "deepseek-r1:8b": { "name": "deepseek-r1:8b" } } } } }
In OpenCode, I can successfully connect to the self-hosted Ollama and use the gemma4 model. However, there is one issue: in an OpenCode conversation, I want it to help me build a web page, but instead of generating files, it only displays the code in the chat window.
Am I missing some configuration, or is there an additional setting required?
These issues share the same root cause: local models via Ollama often lack reliable tool-calling support, causing write/edit tool calls to be printed as JSON in the chat instead of being executed. The behavior you're seeing is a known limitation with some local models that don't properly support the function/tool calling protocol required by OpenCode.
Activity
github-actions commentedon May 30, 2026
This issue might be a duplicate of existing issues. Please check:
These issues share the same root cause: local models via Ollama often lack reliable tool-calling support, causing write/edit tool calls to be printed as JSON in the chat instead of being executed. The behavior you're seeing is a known limitation with some local models that don't properly support the function/tool calling protocol required by OpenCode.
spitzerd commentedon Jun 7, 2026
Gemma4 and Gemini are closely related, see https://blog.google/innovation-and-ai/technology/developers-tools/gemma-4/
In OpenCode, there is a lot of Gemini specific code. For example, there is a specific system prompt for Gemini, see https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/session/system.ts#L28
I fixed the issue as follows:
gemma4ollama create gemini-gemma4:12b -f gemma4ollama launch opencode --model gemini-gemma4:12bMy
opencode.jsoncis empty.This way, OpenCode threats Gemma4 as Gemini model.
rekram1-node commentedon Jun 23, 2026
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.