Repository navigation
Kimi K2 via AWS BEDROCK stops execution #11210
Description
Activity
github-actions commented
on Jan 29, 2026 on Jan 29, 2026 – with GitHub ActionsContributorMore actionsThis issue might be a duplicate of existing issues. Please check:
- toolResults sent to AWS/Bedrock models rejected for missing json subdocument #11035: toolResults sent to AWS/Bedrock models rejected for missing json subdocument (similar AWS Bedrock content validation errors)
- Amazon Bedrock Kimi2 Thinking output #5630: Amazon Bedrock Kimi2 Thinking output (exact same model + service combination with similar content handling issues)
- Kimi for Coding (k2p5) fails with tool calls when thinking enabled: reasoning_content is missing in assistant tool call message #10996: Kimi K2.5 fails with tool calls when thinking enabled (nearly identical error pattern with missing content field)
- Qwen3 as well as Kimi K2 keep stopping mid-chat #1522: Qwen3 as well as Kimi K2 keep stopping mid-chat (Kimi K2 execution stops during operation)
- Kimi K2 Thinking tool calling problems - missing arguments. #9878: Kimi K2 Thinking tool calling problems - missing arguments (empty content in message fields, similar root cause)
Feel free to ignore if none of these address your specific case.
can u do
opencode export > session.json(run it in your terminal) and send me the file?I have the same problem with AWS Bedrock. It just stops working, no errors. This is the last message from the session
{ "info": { "id": "msg_c0e43e070001hTCBgH6Zrlvy5d", "sessionID": "ses_3f1bc2d5bffe8l5qIdzMHGrHwi", "role": "assistant", "time": { "created": 1769765855344, "completed": 1769765856801 }, "parentID": "msg_c0e43d2a9001pMXmtXI2LMRfhw", "modelID": "moonshot.kimi-k2-thinking", "providerID": "amazon-bedrock", "mode": "build", "agent": "build", "path": { "cwd": "/app/redacted", "root": "/app/redacted" }, "cost": 0.0097642, "tokens": { "input": 16032, "output": 58, "reasoning": 0, "cache": { "read": 0, "write": 0 } }, "finish": "stop" }, "parts": [ { "id": "prt_c0e43e493001pVJ767CY6ZbyDX", "sessionID": "ses_3f1bc2d5bffe8l5qIdzMHGrHwi", "messageID": "msg_c0e43e070001hTCBgH6Zrlvy5d", "type": "step-start", "snapshot": "1b7f4a67e65f4eed88bad8209cdba3c06dbcd0af" }, { "id": "prt_c0e43e494001gSwAL8wgyxEHpO", "sessionID": "ses_3f1bc2d5bffe8l5qIdzMHGrHwi", "messageID": "msg_c0e43e070001hTCBgH6Zrlvy5d", "type": "reasoning", "text": " Now let me check the api POST handler: <|tool_calls_section_begin|> <|tool_call_begin|> tooluse_Vbs57l9NT6-Lu5tgQRwYjA{\"filePath\": \"/app/redacted/apps/api\"} <|tool_call_end|> <|tool_calls_section_end|>", "time": { "start": 1769765856404, "end": 1769765856722 } }, { "id": "prt_c0e43e5d3001w6VIfnEZTNfCZ7", "sessionID": "ses_3f1bc2d5bffe8l5qIdzMHGrHwi", "messageID": "msg_c0e43e070001hTCBgH6Zrlvy5d", "type": "step-finish", "reason": "stop", "snapshot": "1b7f4a67e65f4eed88bad8209cdba3c06dbcd0af", "cost": 0.0097642, "tokens": { "input": 16032, "output": 58, "reasoning": 0, "cache": { "read": 0, "write": 0 } } } ] }I can confirm the same error with AWS Bedrock with Minimax M2 (after a while), Kimi K2 (after a while), but the Claude Sonnet and Opus 4.5 and AWS Nova Pro works just fine.
I can confirm the same error with AWS Bedrock with Minimax M2 (after a while), Kimi K2 (after a while), but the Claude Sonnet and Opus 4.5 and AWS Nova Pro works just fine.
I tried Minimax M2 from AWS Bedrock and it worked fine, but I will try it on a long running task. I'm using opencode version
1.1.42have the same issue with kimi 2.5 on chutes:
▼ 21:52:47 [DEBUG] message_part_updated { data = { _directory = "/Users/admin/work/lua/opencode.nvim", part = { id = "prt_c5331af40001C45ZG6iO3Atuv4", messageID = "msg_c5331a388001LciZI4AcrQA9nK", sessionID = "ses_3accfab03ffeUoFBVUj3SfoIEL", text = " ## Analysis\n\nNow I understand the issue! The user cannot enter normal mode while using the widget for selecting models. Let me analyze the keymaps in the `create_sea... <|tool_calls_section_begin|> <|tool_call_begin|> functions.grep:6 <|tool_call_argument_begin|> {"pattern": "startinsert", "path": "/Users/admin/work/lua/opencode.nvim", "include": "*.lua"} <|tool_call_end|> <|tool_calls_section_end|> time = { ["end"] = 1770922367158, start = 1770922291008 }, type = "reasoning" } } }I am seeing this with some regularity using bedrock. Two different error messages:
undefined: There is nothing available to cache. Please remove the invalid cache point and try again. ... undefined: The content field in the Message object at messages.99 is empty. Add a ContentBlock object to the content field and try again.I haven't figured out a good workaround. Forking the session doesn't seem to fix it consistently.
Reacted by Tim PetricolaYeah I think Ik why this happens.
Running into this as well
Any updates on this? fix?
I've been looking into this and there are a couple of things that need to be fixed, related with how Bedrock handles tool calls with the ConverseAPI. I still need to do some tests but I should have a PR later today or tomorrow. @rekram1-node I might check with you on discord to see what you think about this
Reacted by Benjamin Bartels and angelDrivanaOpened a fix for this: #14586. Extends the empty content filtering in normalizeMessages() to cover @ai-sdk/amazon-bedrock. I noticed this happened on Anthropic models on bedrock too. One-line change + tests.
@Tom-Ryder your pr is only partly addressing the issue here. idk if you tested your changes by getting Kimi 2 to make a tool call, but with them, a chat with Kimi 2 Thinking still stops after a tool call.
As I mentioned before, the root cause is how Amazon Bedrock ConverseAPI handles tool calls and how Kimi 2 Thinking sends them.
@NachoFLizaur Yeah, I am aware of the tool call issues on the Bedrock side, and they have fixes in flight for them. This PR specifically targets the empty content filtering that also breaks Claude models on Bedrock (both the "content field is empty" and "nothing available to cache" errors). Should be complementary to a broader Bedrock tool call fix.
Fair enough, you are right! Might be worth opening the discussion on how to tackle the tool calls in a separate issue for the future.
Thanks!
I ran into this on v1.2.11 with Kimi K2.5 and K2 Thinking on Bedrock. PR #14586 fixes the empty-string content case, but there's a second path that still produces empty content after that fix.
The interleaved reasoning filter at
transform.ts:136-169runs after the empty content guard at lines 52-72. When a model hasinterleaved: { field: "reasoning_content" }, it strips reasoning parts fromcontentand moves them toproviderOptions. If an assistant message has only reasoning parts (no text or tool-call),filteredContentbecomes[]. The empty content guard already ran at that point, so nothing catches this.I applied PR #14586's change locally and confirmed the bug still reproduces:
const msgs = [ { role: "user", content: "hello" }, { role: "assistant", content: [ { type: "reasoning", text: "Let me think about this..." }, ], }, { role: "user", content: "go on" }, ] as any[] const result = ProviderTransform.message(msgs, kimiK2_5BedrockModel, {}) // result[1].content === [] still empty even with #14586 applied
The empty content guard at line 62 keeps these parts because their text is not empty. They have real content. Then the interleaved filter at line 144 strips them anyway. A post-filter check in the interleaved block, or moving the empty content guard to run after all transforms, would catch this.
Also, once this hits, switching to Claude Opus in the same session doesn't help. The empty message is stuck in the history and breaks every model until you start a new session.
Good catch. I've added a post-filter check in the interleaved block. Assistant messages where filteredContent.length === 0 after stripping reasoning parts are now dropped rather than passed to Bedrock as content: []. PR updated.
Worth noting: for Kimi K2.5 and K2 Thinking on Bedrock specifically, models.dev currently returns interleaved: true (plain boolean) for those models, not the object form {field: "reasoning_content"}. The interleaved block only fires for the object form, so the real-world errors with Kimi were, I think, coming from the empty-string path. The object-form interleaved path currently affects zai.glm-4.7 on Bedrock. Either way the PR now covers both.
Reacted by Juan Pablo (JP)This is happening not only for Kimi, but as well for Claude (reproducible with sonnet 4.5 and opus 4.6)
amazon-bedrock/anthropic.claude-sonnet-4-5-20250929-v1:0 amazon-bedrock/anthropic.claude-opus-4-6-v1Edit: For my case, it only happens when it tries to compact.
As a workaround, I change the model, run/compactcommand and change back to bedrock models. Works for now.Reacted by Tom Ryder, Juan Pablo (JP) and mapuya19Confirming this is still reproducible for Bedrock-only Claude workflows. Also supporting PR #14586 as the concrete fix path for the empty-content validation failure.
Reacted by Juan Pablo (JP) and Igor Gentil
Description
I'm using Kimi K2 Thinking from bedrock and get the following error in plan mode:
undefined: The content field in the Message object at messages.3 is empty. Add a ContentBlock object to the content field and try again.Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response