[GH-ISSUE #15943] gemma4: <channel|> token sometimes emitted after tool call and unprocessed, causing further issue #72211

Closed
opened 2026-05-05 03:38:18 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @marius851000 on GitHub (May 3, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15943

What is the issue?

I have noticed that, when calling function, it appears gemma4:26b often (if not always) leaves a "thought
<channel|>" before emitting the response, which I suspect might be the cause it doesn’t manage to exit thinking context when it should a few messages afterward.

Logs from an instrumented version of ollama.

Relevant log output

conversation.md

log.txt

OS

Linux

GPU

Nvidia

CPU

AMD

Ollama version

0.0.0 (938ca6e274 , including all the changes from 0.22.1)

Using Zed as client

Originally created by @marius851000 on GitHub (May 3, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15943 ### What is the issue? I have noticed that, when calling function, it appears gemma4:26b often (if not always) leaves a "thought <channel|>" before emitting the response, which I suspect might be the cause it doesn’t manage to exit thinking context when it should a few messages afterward. Logs from an instrumented version of ollama. ### Relevant log output [conversation.md](https://github.com/user-attachments/files/27314602/conversation.md) [log.txt](https://github.com/user-attachments/files/27314603/log.txt) ### OS Linux ### GPU Nvidia ### CPU AMD ### Ollama version 0.0.0 (938ca6e274a9b5546e05674813124ac370b95f69 , including all the changes from 0.22.1) Using Zed as client
GiteaMirror added the bug label 2026-05-05 03:38:19 -05:00
Author
Owner

@marius851000 commented on GitHub (May 3, 2026):

Some more loggin show it might be client-side error: I get request like:

{ "role": "user", "content": "Tell me,  what does file \"a\" contain?" },
{
  "role": "assistant",
  "content": "The user is asking for the content of a file named \"a\".\nFirst, I need to find where the file \"a\" is located in the project.\nI will use the `find_path` tool with a glob pattern to search for \"a\".",
  "tool_calls": [
    {
      "id": "call_5622uk7v",
      "function": { "name": "find_path", "arguments": { "glob": "**/a" } }
    }
  ],
  "thinking": "The user is asking for the content of a file named \"a\".\nFirst, I need to find where the file \"a\" is located in the project.\nI will use the `find_path` tool with a glob pattern to search for \"a\"."
},
{
  "role": "tool",
  "tool_name": "find_path",
  "content": "Found 1 total matches.\n/home/marius/ollama/a"
},
{
  "role": "assistant",
  "content": "<channel|>",
  "tool_calls": [
    {
      "id": "call_mlosyd5s",
      "function": {
        "name": "read_file",
        "arguments": { "path": "ollama/a" }
      }
    }
  ],
  "thinking": null
},
{
  "role": "tool",
  "tool_name": "read_file",
  "content": "<Tool returned an empty string>"
}
<!-- gh-comment-id:4365805031 --> @marius851000 commented on GitHub (May 3, 2026): Some more loggin show it might be client-side error: I get request like: ```json { "role": "user", "content": "Tell me, what does file \"a\" contain?" }, { "role": "assistant", "content": "The user is asking for the content of a file named \"a\".\nFirst, I need to find where the file \"a\" is located in the project.\nI will use the `find_path` tool with a glob pattern to search for \"a\".", "tool_calls": [ { "id": "call_5622uk7v", "function": { "name": "find_path", "arguments": { "glob": "**/a" } } } ], "thinking": "The user is asking for the content of a file named \"a\".\nFirst, I need to find where the file \"a\" is located in the project.\nI will use the `find_path` tool with a glob pattern to search for \"a\"." }, { "role": "tool", "tool_name": "find_path", "content": "Found 1 total matches.\n/home/marius/ollama/a" }, { "role": "assistant", "content": "<channel|>", "tool_calls": [ { "id": "call_mlosyd5s", "function": { "name": "read_file", "arguments": { "path": "ollama/a" } } } ], "thinking": null }, { "role": "tool", "tool_name": "read_file", "content": "<Tool returned an empty string>" } ```
Author
Owner

@marius851000 commented on GitHub (May 3, 2026):

Very well. With my own fix for this issue, this does not appear. I’ll stay alert if error like I met crop up again.

The issue appears with the client sending both content and thinking in the same... turn? part?

Closing as this is a client error.

<!-- gh-comment-id:4365881998 --> @marius851000 commented on GitHub (May 3, 2026): Very well. With my own fix for this issue, this does not appear. I’ll stay alert if error like I met crop up again. The issue appears with the client sending both content and thinking in the same... turn? part? Closing as this is a client error.
Author
Owner

@marius851000 commented on GitHub (May 3, 2026):

It appear that this fix on Zed does not fix that. I will hence re-open the ticket and continue looking around.
https://github.com/zed-industries/zed/pull/55540

<!-- gh-comment-id:4367073235 --> @marius851000 commented on GitHub (May 3, 2026): It appear that this fix on Zed does not fix that. I will hence re-open the ticket and continue looking around. https://github.com/zed-industries/zed/pull/55540
Author
Owner

@marius851000 commented on GitHub (May 3, 2026):

You know what? I’m not sure about anything now. I’ll close it and only re-open once I have an actual fix (or understanding)

<!-- gh-comment-id:4367119014 --> @marius851000 commented on GitHub (May 3, 2026): You know what? I’m not sure about anything now. I’ll close it and only re-open once I have an actual fix (or understanding)
Author
Owner

@marius851000 commented on GitHub (May 4, 2026):

Well, not something worth re-opening, but it appear the cause of the weird behavior I see is caused by the model apparently deciding on using tool call while thinking, send the thinking stop to perform the tool call, but then pick the triple-backtick token instead of the tool call.

This is the only time the tool call token is in the top ten. I clearly state it’ll do further tool call, and when it does it, it appear to want to call the end-of-thinking channel, so apparently, gemma4 can’t do toll call if not already thinking.

Some other time, it also think of using the start thinking token in such case, but never enought.

<!-- gh-comment-id:4373636850 --> @marius851000 commented on GitHub (May 4, 2026): Well, not something worth re-opening, but it appear the cause of the weird behavior I see is caused by the model apparently deciding on using tool call while thinking, send the thinking stop to perform the tool call, but then pick the triple-backtick token instead of the tool call. This is the only time the tool call token is in the top ten. I clearly state it’ll do further tool call, and when it does it, it appear to want to call the end-of-thinking channel, so apparently, gemma4 can’t do toll call if not already thinking. Some other time, it also think of using the start thinking token in such case, but never enought.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#72211