[GH-ISSUE #15647] tool_call.arguments truncated to exactly 214 chars on Ollama Cloud API #72043

Open
opened 2026-05-05 03:23:40 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @ruhtraxjj on GitHub (Apr 17, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15647

Bug Description
When using models via the Ollama Cloud API (https://ollama.com/v1), tool_call.function.arguments is truncated to exactly 214 characters.
This produces invalid JSON that causes HTTP 400: invalid tool call
arguments on subsequent API calls that include the truncated
arguments in conversation history.

Steps to Reproduce

  1. Call POST /v1/chat/completions with glm-5.1 (or qwen3.5) and tool definitions
  2. In a multi-turn conversation where the model generates tool calls
    with arguments > 214 chars 3. The returned tool_call.function.arguments is truncated to exactly
    214 characters 4. Sending the conversation history (including the truncated args)
    back to the API returns 400: invalid tool call arguments
    Evidence
    Across 35+ error instances, every single invalid arguments field is exactly 214 characters long, strongly suggesting a server-side buffer or limit:

All 46 invalid tool_calls: 214 chars (100%)

Examples of truncated arguments:

  • {"code":"from hermes_tools import terminal\n\nrepos = [\n
    ("alexpate/awesome-design-systems"... → truncated mid-string - {"command":"cd ~/design-md && for d in */; do echo "${d%/}"; done
    | sort > /tmp/... → truncated mid-command - {"path":"/home/emma/北雅英语/BEIYA-DESIGN-WORKFLOW.md","content":"# 北雅 AI 设计... → truncated mid-content
    Expected Behavior
    tool_call.function.arguments should contain complete, valid JSON regardless of length. If there is a length limit, the model should be constrained to produce arguments within that limit, or the API
    should return an error rather than silently truncating.

Environment

  • Ollama Cloud API (https://ollama.com/v1) - Models: glm-5.1, qwen3.5:397b, glm-5.1:cloud (via local Ollama)
  • Plan: Pro
Originally created by @ruhtraxjj on GitHub (Apr 17, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15647 Bug Description When using models via the Ollama Cloud API (https://ollama.com/v1), tool_call.function.arguments is truncated to exactly 214 characters. This produces invalid JSON that causes HTTP 400: invalid tool call arguments on subsequent API calls that include the truncated arguments in conversation history. Steps to Reproduce 1. Call POST /v1/chat/completions with glm-5.1 (or qwen3.5) and tool definitions 2. In a multi-turn conversation where the model generates tool calls with arguments > 214 chars 3. The returned tool_call.function.arguments is truncated to exactly 214 characters 4. Sending the conversation history (including the truncated args) back to the API returns 400: invalid tool call arguments Evidence Across 35+ error instances, every single invalid arguments field is exactly 214 characters long, strongly suggesting a server-side buffer or limit: All 46 invalid tool_calls: 214 chars (100%) Examples of truncated arguments: - {"code":"from hermes_tools import terminal\n\nrepos = [\n (\"alexpate/awesome-design-systems\"... → truncated mid-string - {"command":"cd ~/design-md && for d in */; do echo \"${d%/}\"; done | sort > /tmp/... → truncated mid-command - {"path":"/home/emma/北雅英语/BEIYA-DESIGN-WORKFLOW.md","content":"# 北雅 AI 设计... → truncated mid-content Expected Behavior tool_call.function.arguments should contain complete, valid JSON regardless of length. If there is a length limit, the model should be constrained to produce arguments within that limit, or the API should return an error rather than silently truncating. Environment - Ollama Cloud API (https://ollama.com/v1) - Models: glm-5.1, qwen3.5:397b, glm-5.1:cloud (via local Ollama) - Plan: Pro
GiteaMirror added the cloud label 2026-05-05 03:23:40 -05:00
Author
Owner

@PureBlissAK commented on GitHub (Apr 18, 2026):

🤖 Automated Triage & Analysis Report

Issue: #15647
Analyzed: 2026-04-18T18:13:50.898637

Analysis

  • Type: unknown
  • Severity: medium
  • Components: unknown

Implementation Plan

  • Effort: medium
  • Steps:

This issue has been triaged and marked for implementation.

<!-- gh-comment-id:4274295028 --> @PureBlissAK commented on GitHub (Apr 18, 2026): <!-- ollama-issue-orchestrator:v1 issue:15647 --> ## 🤖 Automated Triage & Analysis Report **Issue**: #15647 **Analyzed**: 2026-04-18T18:13:50.898637 ### Analysis - **Type**: unknown - **Severity**: medium - **Components**: unknown ### Implementation Plan - **Effort**: medium - **Steps**: *This issue has been triaged and marked for implementation.*
Author
Owner

@horendus commented on GitHub (Apr 21, 2026):

Solid analysis by the bot

<!-- gh-comment-id:4289509708 --> @horendus commented on GitHub (Apr 21, 2026): Solid analysis by the bot
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#72043