-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
[Bug]: RangeError: Maximum call stack size exceeded on chat.send with image attachment near context limit #38859
Description
Bug type
Behavior bug (incorrect output/state without crash)
Summary
Sending a message with an image attachment via the Control UI triggers a RangeError: Maximum call stack size exceeded when the session context is near capacity. The message (text + image) is silently dropped and the raw error is displayed to the user.
Steps to reproduce
- Run an agent session with heavy tool use until context is near compaction threshold.
- Send a message with an image attachment via the Control UI (webchat channel).
- Observe
chat.sendfailure in gateway logs.
Expected behavior
The message should either be processed normally, trigger compaction first then process, or return a user-friendly error indicating context is full.
Actual behavior
chat.send fails with errorCode=INVALID_REQUEST and errorMessage=RangeError: Maximum call stack size exceeded. The error appears in the Control UI as both a banner and a fake agent "reply." The user's message + image are silently dropped with no recovery. No compaction is triggered by the failure. The error occurred twice on retry (49ms and 66ms processing time, indicating immediate recursion).
OpenClaw version
2026.3.2
Operating system
Ubuntu (Debian 13/trixie kernel 6.12.73, x64, Hyper-V VM)
Install method
npm global
Logs, screenshots, and evidence
2026-03-07T12:45:30.287Z [ws] ⇄ res ✗ chat.send 49ms errorCode=INVALID_REQUEST errorMessage=RangeError: Maximum call stack size exceeded conn=defefda6…514e id=549bcb99…e4b4
2026-03-07T12:47:25.613Z [ws] ⇄ res ✗ chat.send 66ms errorCode=INVALID_REQUEST errorMessage=RangeError: Maximum call stack size exceeded conn=defefda6…514e id=205a9238…e4e3
No full stack trace was logged — only the one-line error above. A full stack trace would help identify the recursive call chain.Impact and severity
- Affected: Any user sending image attachments via Control UI when context is near-full
- Severity: High — user message is silently dropped (data loss), raw JS error shown to user
- Frequency: Edge case — requires context to be near capacity + image attachment
- Consequence: User's message (text + image) is permanently lost. No automatic recovery or compaction triggered. Poor error UX (raw
RangeErrordisplayed instead of helpful message).
Additional information
- The 49ms/66ms processing times suggest the recursion happens immediately in the message/image processing pipeline, not after extended computation.
- The session recovered after compaction occurred independently (not triggered by the error).
- Model: claude-proxy (Anthropic Claude) via custom proxy.
- Channel: Control UI (webchat provider).
- No prior version tested — first occurrence on 2026.3.2.
- Workaround: Wait for compaction to free context before sending image attachments.