[GH-ISSUE #15829] No Context Memory & Tool Calling Failure with Local Gemma4 via Ollama Docker #87776

Open
opened 2026-05-10 06:22:40 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @OrzHex on GitHub (Apr 27, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15829

What is the issue?

I containerized Ollama using Docker and pulled the local gemma4:e2b / gemma4:26b models. I connect via port 11434. Both cc-haha (https://github.com/NanmiCoder/cc-haha ) and claude-code-tudou (https://github.com/AICoderTudou/claude-code-tudou ) can connect normally — the web interface loads and regular chat works.

However, two critical issues occur:
The conversation has no context memory (the model cannot remember previous messages in the chat).
Tool calling / function usage is not working.

How can I fix these problems?

Example of the context loss issue:
You: Hi, I am Tom. I am 8 years old.
AI: Hi Tom! Nice to meet you.
You: How old is Tom?
AI: I am gemma4. I do not have an age.

Example of the tool calling abnormal issue:
You: Open local file config.json.
AI: I can help you with file-related questions. Please tell me more details.

Relevant log output


OS

Docker

GPU

No response

CPU

Intel

Ollama version

0.21.1

Originally created by @OrzHex on GitHub (Apr 27, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15829 ### What is the issue? I containerized Ollama using Docker and pulled the local gemma4:e2b / gemma4:26b models. I connect via port 11434. Both cc-haha (https://github.com/NanmiCoder/cc-haha ) and claude-code-tudou (https://github.com/AICoderTudou/claude-code-tudou ) can connect normally — the web interface loads and regular chat works. However, two critical issues occur: The conversation has no context memory (the model cannot remember previous messages in the chat). Tool calling / function usage is not working. How can I fix these problems? Example of the context loss issue: You: Hi, I am Tom. I am 8 years old. AI: Hi Tom! Nice to meet you. You: How old is Tom? AI: I am gemma4. I do not have an age. Example of the tool calling abnormal issue: You: Open local file config.json. AI: I can help you with file-related questions. Please tell me more details. ### Relevant log output ```shell ``` ### OS Docker ### GPU _No response_ ### CPU Intel ### Ollama version 0.21.1
GiteaMirror added the bug label 2026-05-10 06:22:40 -05:00
Author
Owner

@rick-github commented on GitHub (May 8, 2026):

Context memory is maintained by the client.

$ docker run --rm -d --name ollama-15829 ollama/ollama:0.21.1
$ docker exec -it ollama-15829 ollama run gemma4:e2b --think=false
>>> Hi, I am Tom. I am 8 years old.
Hi Tom! It's very nice to meet you. I'm a large language model.

How are you doing today? Is there anything you'd like to talk about or anything you're curious about? 😊

>>> How old is Tom? 
You told me that **you** are 8 years old, Tom! So, according to what you told me, **Tom is 8 years old.** 😊

Tool failures when using an agent/harness are usually because the context is too small to hold the tool definitions. Increase the context length.

<!-- gh-comment-id:4406199576 --> @rick-github commented on GitHub (May 8, 2026): Context memory is maintained by the client. ```console $ docker run --rm -d --name ollama-15829 ollama/ollama:0.21.1 $ docker exec -it ollama-15829 ollama run gemma4:e2b --think=false >>> Hi, I am Tom. I am 8 years old. Hi Tom! It's very nice to meet you. I'm a large language model. How are you doing today? Is there anything you'd like to talk about or anything you're curious about? 😊 >>> How old is Tom? You told me that **you** are 8 years old, Tom! So, according to what you told me, **Tom is 8 years old.** 😊 ``` Tool failures when using an agent/harness are usually because the context is too small to hold the tool definitions. Increase the [context length](https://github.com/ollama/ollama/blob/main/docs/faq.mdx#how-can-i-specify-the-context-window-size).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#87776