hermes - 💡(How to fix) Fix 【Bug】Truncated tool_call arguments silently succeed instead of returning error [1 pull requests]

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…

Error Message

When tool_call arguments are unrepairable (truncated/broken), Hermes should return a tool error to the model instead of silently succeeding with empty arguments. This signals the model to adjust its approach. Suggested error message:

  1. Repeat failure detection: Track consecutive failures of the same tool+target pattern (e.g., write_file to same filename 3+ times). After threshold, return a blocking error and suggest the model use a different strategy.
  2. Pre-emptive content length check: If a tool_call argument field exceeds a configurable threshold (e.g., 80% of max_output_tokens), warn or reject before execution, suggesting the model split the content.

Fix Action

Fixed

Code Example

WARNING agent.message_sanitization: Unrepairable tool_call arguments for write_file — replaced with empty object (was: {"content":"#!/usr/bin/env python3\n\"\"\"\nHermes 多租户 K8s 路由控制器 v2\n===========)

---

Tool call arguments were truncated due to output length limit. Please shorten the content or split into multiple tool calls.
RAW_BUFFERClick to expand / collapse

Problem

When a model's tool_call JSON is truncated due to output length limits (max_tokens), Hermes replaces the unparseable arguments with an empty object {} and treats the tool execution as successful. This causes a problematic loop:

  1. Model returns write_file with large content field
  2. Output is truncated mid-JSON (content exceeds max_tokens)
  3. Hermes sanitizes: replaces args with {}
  4. write_file executes with empty content → "success"
  5. Model receives success, retries same write
  6. Same truncation → same empty replacement → repeats

This wastes API calls, tokens, and time (~60s per failed attempt). Observed with glm-5.1 writing files >200 lines.

Log evidence

WARNING agent.message_sanitization: Unrepairable tool_call arguments for write_file — replaced with empty object (was: {"content":"#!/usr/bin/env python3\n\"\"\"\nHermes 多租户 K8s 路由控制器 v2\n===========)

The file content starts writing but JSON never closes. The same file is retried multiple times (observed 3+ consecutive failures).

Expected behavior

When tool_call arguments are unrepairable (truncated/broken), Hermes should return a tool error to the model instead of silently succeeding with empty arguments. This signals the model to adjust its approach.

Suggested error message:

Tool call arguments were truncated due to output length limit. Please shorten the content or split into multiple tool calls.

Additional optimizations (optional)

  1. Repeat failure detection: Track consecutive failures of the same tool+target pattern (e.g., write_file to same filename 3+ times). After threshold, return a blocking error and suggest the model use a different strategy.

  2. Pre-emptive content length check: If a tool_call argument field exceeds a configurable threshold (e.g., 80% of max_output_tokens), warn or reject before execution, suggesting the model split the content.

Environment

  • Hermes agent: latest (gateway run --replace)
  • Model: glm-5.1 (via OpenAI-compatible API)
  • Session: multi-turn conversation with 90 API call budget

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…

FAQ

Expected behavior

When tool_call arguments are unrepairable (truncated/broken), Hermes should return a tool error to the model instead of silently succeeding with empty arguments. This signals the model to adjust its approach.

Suggested error message:

Tool call arguments were truncated due to output length limit. Please shorten the content or split into multiple tool calls.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix 【Bug】Truncated tool_call arguments silently succeed instead of returning error [1 pull requests]