openclaw - 💡(How to fix) Fix [Bug]: Long sessions (600+ messages) break with "invalid function call parameters" [1 comments, 1 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
openclaw/openclaw#58553Fetched 2026-04-08 02:01:09
View on GitHub
Comments
1
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

After chatting in a single session for a while (600+ messages, lots of tool calls), the API starts returning:

400 - code 11129: "invalid function call parameters" This isn't a context length issue — that would say "context length exceeded". It looks like something goes wrong with how historical toolCall/toolResult pairs get serialized when there are hundreds of them.

What I saw:

Request with 604 messages → 400 Request with 607 messages → 400 A different request with 2 messages hit the same API at the same time → 200 OK Opening a new chat window fixed it immediately So the API itself is fine — it's something about the accumulated message history that becomes invalid over time.

My guess: Somewhere in the serialization pipeline, old tool call entries get slightly malformed — maybe a toolCall without its matching toolResult, or an arguments field that doesn't round-trip cleanly. With 600+ messages the odds of hitting one go up.

Environment:

ClawX gateway-client claude-opus-4.6-1m Custom context engine plugin (ownsCompaction: true)

Root Cause

After chatting in a single session for a while (600+ messages, lots of tool calls), the API starts returning:

400 - code 11129: "invalid function call parameters" This isn't a context length issue — that would say "context length exceeded". It looks like something goes wrong with how historical toolCall/toolResult pairs get serialized when there are hundreds of them.

What I saw:

Request with 604 messages → 400 Request with 607 messages → 400 A different request with 2 messages hit the same API at the same time → 200 OK Opening a new chat window fixed it immediately So the API itself is fine — it's something about the accumulated message history that becomes invalid over time.

My guess: Somewhere in the serialization pipeline, old tool call entries get slightly malformed — maybe a toolCall without its matching toolResult, or an arguments field that doesn't round-trip cleanly. With 600+ messages the odds of hitting one go up.

Environment:

ClawX gateway-client claude-opus-4.6-1m Custom context engine plugin (ownsCompaction: true)

Code Example

-
RAW_BUFFERClick to expand / collapse

Bug type

Crash (process/app exits or hangs)

Beta release blocker

No

Summary

After chatting in a single session for a while (600+ messages, lots of tool calls), the API starts returning:

400 - code 11129: "invalid function call parameters" This isn't a context length issue — that would say "context length exceeded". It looks like something goes wrong with how historical toolCall/toolResult pairs get serialized when there are hundreds of them.

What I saw:

Request with 604 messages → 400 Request with 607 messages → 400 A different request with 2 messages hit the same API at the same time → 200 OK Opening a new chat window fixed it immediately So the API itself is fine — it's something about the accumulated message history that becomes invalid over time.

My guess: Somewhere in the serialization pipeline, old tool call entries get slightly malformed — maybe a toolCall without its matching toolResult, or an arguments field that doesn't round-trip cleanly. With 600+ messages the odds of hitting one go up.

Environment:

ClawX gateway-client claude-opus-4.6-1m Custom context engine plugin (ownsCompaction: true)

Steps to reproduce

Expected behavior

Actual behavior

OpenClaw version

v2026.3.24

Operating system

Windows11

Install method

clawx

Model

claude-opus-4.6-1m

Provider / routing chain

openclaw ->clawx

Additional provider/model setup details

Logs, screenshots, and evidence

-

Impact and severity

Additional information

extent analysis

TL;DR

The issue can likely be resolved by addressing the serialization of historical toolCall/toolResult pairs in the context engine plugin, potentially by implementing a mechanism to clean up or validate the accumulated message history.

Guidance

  • Investigate the custom context engine plugin's serialization pipeline to identify potential issues with old tool call entries becoming malformed, such as missing matching toolResults or arguments fields that don't round-trip cleanly.
  • Verify that the ownsCompaction: true setting in the custom context engine plugin is correctly handling the compaction of the message history.
  • Test the API with a smaller number of messages to see if the issue still occurs, and if not, gradually increase the number of messages to identify the threshold at which the issue starts to happen.
  • Consider implementing a temporary workaround, such as periodically clearing or resetting the accumulated message history, to mitigate the issue until a permanent fix can be implemented.

Example

No specific code snippet can be provided without more information about the custom context engine plugin's implementation.

Notes

The root cause of the issue is likely related to the serialization of historical toolCall/toolResult pairs, but the exact cause and solution may depend on the specific implementation of the custom context engine plugin.

Recommendation

Apply a workaround, such as periodically clearing or resetting the accumulated message history, to mitigate the issue until a permanent fix can be implemented, as the root cause is likely related to the custom context engine plugin's serialization pipeline.

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

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: Long sessions (600+ messages) break with "invalid function call parameters" [1 comments, 1 participants]