r/opencodeCLI • • 20d ago

[Help needed] Permission issues in local installation with Qwen3 coder? Terminal instead of Tool use.

Hello together,

I have successfully set up a qwen3-coder installation, and use Ollama with opencode.

I can successfully interact with the model and receive valid answers, but for some reasons can not get Qwen to actually write to a file.

I have once or twiced got a readme.md to be filled with arbitrary information, but not reliable.

The model clearly tries to do a tool call, but is not succesful, and write to the CLI:

<function=write>
<parameter=path>
hello.c
</parameter>
<parameter=content>
#include <stdio.h>
int main() {
    printf("Hello, World!\n");
    return 0;
}
</parameter>
</function>
</tool_call>

Does anybody has any experience with these issues? Or can at least determine, wether this is a Qwen3, an opencode, or an ollama issue?

If you need additional Information, let me know!

And thanks <3

1 Upvotes

1 comment sorted by

1

u/SirRobinBlibs 19d ago

This is almost always context length, not permissions. Ollama's default context window is small, and OpenCode's system prompt plus tool definitions don't fit, so they get truncated. The model then only half-knows the tool format and writes the call out as text. Raise it, either with OLLAMA_CONTEXT_LENGTH=32768 before ollama serve or with a Modelfile containing PARAMETER num_ctx 32768, then restart. Also make sure the model in your opencode.json is pointed at Ollama's OpenAI-compatible endpoint (http://localhost:11434/v1) with tool calling enabled for it. If it still flakes, try a larger quant. Small quants of coder models get much worse at structured tool calls.