Skip to content

Kimi K2 via AWS BEDROCK stops execution #11210

Description

@FarrukhCyber

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

Activity

  1. github-actions commented on Jan 29, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Jan 29, 2026

    @rekram1-node
    Collaborator

    can u do opencode export > session.json (run it in your terminal) and send me the file?

  3. Ilia-TheNetworkFirm commented on Jan 30, 2026

    @Ilia-TheNetworkFirm

    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
                }
              }
            }
          ]
        }
  4. aries1980 commented on Jan 30, 2026

    @aries1980

    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.

  5. FarrukhCyber commented on Jan 30, 2026

    @FarrukhCyber
    Author

    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.42

  6. wwnbb commented on Feb 12, 2026

    @wwnbb

    have 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"
          }
        }
      }
    
    
  7. JayThomason commented on Feb 20, 2026

    @JayThomason

    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.

  8. rekram1-node commented on Feb 20, 2026

    @rekram1-node
    Collaborator

    Yeah I think Ik why this happens.

  9. bbartels commented on Feb 20, 2026

    @bbartels
    Contributor

    Running into this as well

  10. angelDrivana commented on Feb 21, 2026

    @angelDrivana

    Any updates on this? fix?

  11. NachoFLizaur commented on Feb 21, 2026

    @NachoFLizaur
    Contributor

    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

  12. Tom-Ryder commented on Feb 21, 2026

    @Tom-Ryder
    Contributor

    Opened 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.

  13. NachoFLizaur commented on Feb 21, 2026

    @NachoFLizaur
    Contributor

    @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.

  14. Tom-Ryder commented on Feb 21, 2026

    @Tom-Ryder
    Contributor

    @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.

  15. NachoFLizaur commented on Feb 21, 2026

    @NachoFLizaur
    Contributor

    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!

  16. jpvelasco commented on Feb 25, 2026

    @jpvelasco

    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-169 runs after the empty content guard at lines 52-72. When a model has interleaved: { field: "reasoning_content" }, it strips reasoning parts from content and moves them to providerOptions. If an assistant message has only reasoning parts (no text or tool-call), filteredContent becomes []. 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.

  17. Tom-Ryder commented on Feb 25, 2026

    @Tom-Ryder
    Contributor

    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.

  18. marcosvrs commented on Mar 4, 2026

    @marcosvrs

    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-v1
    

    Edit: For my case, it only happens when it tries to compact.
    As a workaround, I change the model, run /compact command and change back to bedrock models. Works for now.

  19. marcosvrs commented on Mar 8, 2026

    @marcosvrs

    Confirming this is still reproducible for Bedrock-only Claude workflows. Also supporting PR #14586 as the concrete fix path for the empty-content validation failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions