ollama - ✅(Solved) Fix gemma4:31b - Tool Call Fails [2 pull requests, 8 comments, 5 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#15241Fetched 2026-04-08 02:33:48
View on GitHub
Comments
8
Participants
5
Timeline
32
Reactions
4
Timeline (top)
subscribed ×10commented ×8cross-referenced ×4mentioned ×3

Error Message

source=gemma4.go:287 msg="gemma4 tool call parsing failed" error="invalid character 'p' after object key:value pair" content="call:subagent{*****************}"

Fix Action

Fixed

PR fix notes

PR #15254: model/parsers: fix gemma4 arg parsing when quoted strings contain "

Description (problem / solution / changelog)

Fixes: #15241

Changed files

  • model/parsers/gemma4.go (modified, +64/-6)
  • model/parsers/gemma4_test.go (modified, +206/-0)

PR #15255: model/parsers/gemma4: fix tool call argument parsing with internal quotes

Description (problem / solution / changelog)

The Gemma 4 parser now correctly handles tool call arguments that contain internal quotes by properly escaping content within <|"|> quotes. This fixes a parsing error when tool calls included shell commands or other quoted strings.

Fixes #15241

Changed files

  • model/parsers/gemma4.go (modified, +27/-36)
  • model/parsers/gemma4_test.go (modified, +15/-0)

Code Example

source=gemma4.go:287 msg="gemma4 tool call parsing failed" error="invalid character 'p' after object key:value pair" content="call:subagent{*****************}"
RAW_BUFFERClick to expand / collapse

What is the issue?

gemma4 seems to fail a tool call.

Version running is: ollama:0.20.0-rc1

Relevant log output

source=gemma4.go:287 msg="gemma4 tool call parsing failed" error="invalid character 'p' after object key:value pair" content="call:subagent{*****************}"

OS

Docker

GPU

Nvidia

CPU

AMD

Ollama version

0.20.0-rc1

extent analysis

TL;DR

The issue with gemma4 failing a tool call is likely due to a parsing error, and checking the input data for invalid characters may provide a workaround.

Guidance

  • Verify the input data being passed to the gemma4 tool call for any invalid characters, specifically looking for object key-value pairs with trailing characters.
  • Check the documentation for the gemma4 tool call to ensure that the input data format is correct and supported.
  • Consider validating the input data before passing it to the gemma4 tool call to prevent parsing errors.
  • Review the gemma4 source code (e.g., gemma4.go:287) to understand the parsing logic and how it handles different input data formats.

Notes

The provided log output suggests a parsing error, but without more information about the input data or the expected format, it's difficult to provide a more specific solution.

Recommendation

Apply workaround: Validate and sanitize the input data before passing it to the gemma4 tool call to prevent parsing errors, as the root cause of the issue is likely related to the input data format.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING