mirror of
https://github.com/jwadow/kiro-gateway.git
synced 2026-04-25 01:15:57 +03:00
[GH-ISSUE #34] BUG: Dead loop failed to write file #23
Labels
No labels
bug
bug
enhancement
enhancement
fixed
fixed
invalid
needs-info
needs-testing
pull-request
question
upstream
wontfix
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/kiro-gateway-jwadow#23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ykswang on GitHub (Jan 12, 2026).
Original GitHub issue: https://github.com/jwadow/kiro-gateway/issues/34
Kiro Gateway Version
v2.0.0
What happened?
opencode error:
gateway log:
2026-01-12 21:37:42 | INFO | logging:callHandlers:1737 - 127.0.0.1:60307 - "POST /v1/messages HTTP/1.1" 200
2026-01-12 21:38:59 | WARNING | kiro.parsers:_finalize_tool_call:415 - Failed to parse tool 'write' arguments: Expecting ',' delimiter: line 1 column 88 (char 87). Raw: {"filePath": "/Users/cc/Documents/Code/mock-all/docs/plans/2026-01-12-mock-all-impl.md"
2026-01-12 21:38:59 | INFO | kiro.routes_anthropic:stream_wrapper:288 - HTTP 200 - POST /v1/messages (streaming) - completed
2026-01-12 21:39:02 | INFO | kiro.routes_anthropic:messages:144 - Request to /v1/messages (model=claude-opus-4-5, stream=True)
2026-01-12 21:39:05 | INFO | logging:callHandlers:1737 - 127.0.0.1:60307 - "POST /v1/messages HTTP/1.1" 200
2026-01-12 21:40:19 | WARNING | kiro.parsers:_finalize_tool_call:415 - Failed to parse tool 'write' arguments: Expecting ',' delimiter: line 1 column 88 (char 87). Raw: {"filePath": "/Users/cc/Documents/Code/mock-all/docs/plans/2026-01-12-mock-all-impl.md"
2026-01-12 21:40:19 | INFO | kiro.routes_anthropic:stream_wrapper:288 - HTTP 200 - POST /v1/messages (streaming) - completed
claude code failed,too
Debug Logs
@ykswang commented on GitHub (Jan 12, 2026):
kiro_request_body.json
request_body.json
response_stream_raw.txt
@jwadow commented on GitHub (Jan 14, 2026):
Hey, thanks for the logs.
Figured it out - this is not a Kiro Gateway bug.
Kiro API truncates the stream when tool call arguments are too large. Claude was trying to write a huge plan to a file, but the API cut off after filePath, never sending content. Results in broken JSON.
The dead loop happens because OpenCode does not handle repeated failures. When write fails 2-3 times with the same error, OpenCode should inject an ephemeral system message to hint the model to change approach. Without such hints, Claude just keeps retrying the same thing forever.
Added clearer logging for these cases, but cannot fix the core issue.
I suggest opening an issue in the OpenCode repo - they need to add handling for repeated tool call failures via "ephemeral hints".
Workaround: ask the model to write large files in chunks.
@g0dev commented on GitHub (Jan 14, 2026):
I also started seeing this only recently. Before this it was working fine for the same kind of write tool calls.
So it looks like Kiro API might have changed something and is now truncating the stream more aggressively when the tool arguments get big.