opencode zen models tool calls are not parsed correctly mid conversation #2355

Closed
opened 2026-02-16 17:35:17 -05:00 by yindo · 11 comments
Owner

Originally created by @tsah on GitHub (Oct 30, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Switching models mid conversation leads to tool calls not being parsed.

Happened to me today while switching from sonnet 4.5 to kimi k2, happened to me in the past with GLM and big pickle as well

OpenCode version

0.15.29

Steps to reproduce

  1. started conversation in plan mode with sonnet 4.5 (anthropic api key)
  2. switched to build mode with kimi k2 (zen)
  3. Got weird output that looks to me like tool calls that are not parsed correctly

Screenshot and/or share link

Image

Operating System

Arch

Terminal

Ghostty + tmux

Originally created by @tsah on GitHub (Oct 30, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Switching models mid conversation leads to tool calls not being parsed. Happened to me today while switching from sonnet 4.5 to kimi k2, happened to me in the past with GLM and big pickle as well ### OpenCode version 0.15.29 ### Steps to reproduce 1. started conversation in plan mode with sonnet 4.5 (anthropic api key) 2. switched to build mode with kimi k2 (zen) 3. Got weird output that looks to me like tool calls that are not parsed correctly ### Screenshot and/or share link <img width="1761" height="607" alt="Image" src="https://github.com/user-attachments/assets/8bb0bcda-b478-4670-baa9-5b6d15b8a7f7" /> ### Operating System Arch ### Terminal Ghostty + tmux
yindo added the bug label 2026-02-16 17:35:17 -05:00
yindo closed this issue 2026-02-16 17:35:17 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 30, 2025):

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

  • #3035: Model switching between reasoning and non-reasoning models causing tool call issues
  • #1021: Tool Calls Section End Token parsing failures with various models
  • #1018: Failed tool calls when using Groq + Kimi K2 (closed but similar)
  • #2903: GLM-4.6 model losing tool use capability (closed but similar pattern)
  • #1522: Kimi K2 stopping mid-chat issues

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

@github-actions[bot] commented on GitHub (Oct 30, 2025): This issue might be a duplicate of existing issues. Please check: - #3035: Model switching between reasoning and non-reasoning models causing tool call issues - #1021: Tool Calls Section End Token parsing failures with various models - #1018: Failed tool calls when using Groq + Kimi K2 (closed but similar) - #2903: GLM-4.6 model losing tool use capability (closed but similar pattern) - #1522: Kimi K2 stopping mid-chat issues Feel free to ignore if none of these address your specific case.
Author
Owner

@tsah commented on GitHub (Oct 30, 2025):

Yeah looks like a duplicate of 1021

@tsah commented on GitHub (Oct 30, 2025): Yeah looks like a duplicate of 1021
Author
Owner

@tsah commented on GitHub (Oct 30, 2025):

Addition: when switching back to anthropic the problem disappears

@tsah commented on GitHub (Oct 30, 2025): Addition: when switching back to anthropic the problem disappears
Author
Owner

@rekram1-node commented on GitHub (Oct 30, 2025):

this is just the model failing to call tools, it isnt calling them correctly, this can happen for many providers and models just happens more frequently with some than others

@rekram1-node commented on GitHub (Oct 30, 2025): this is just the model failing to call tools, it isnt calling them correctly, this can happen for many providers and models just happens more frequently with some than others
Author
Owner

@Adictya commented on GitHub (Dec 5, 2025):

This happens consistently with kimi k2 thinking. Is there any recommended way to work around it? @rekram1-node

Image
@Adictya commented on GitHub (Dec 5, 2025): This happens consistently with kimi k2 thinking. Is there any recommended way to work around it? @rekram1-node <img width="2540" height="774" alt="Image" src="https://github.com/user-attachments/assets/b909d36c-1347-4ea1-9187-279c6bb4d9e0" />
Author
Owner

@rekram1-node commented on GitHub (Dec 9, 2025):

This should be fixed in next release:
https://github.com/sst/opencode/commit/df64612d540a86d44e12c7f1c516b8ab62a28b65

@rekram1-node commented on GitHub (Dec 9, 2025): This should be fixed in next release: https://github.com/sst/opencode/commit/df64612d540a86d44e12c7f1c516b8ab62a28b65
Author
Owner

@DamianPereira commented on GitHub (Dec 12, 2025):

I tried 1.0.150 and it's still happening. Not sure if it's happening less or not.

Image
@DamianPereira commented on GitHub (Dec 12, 2025): I tried 1.0.150 and it's still happening. Not sure if it's happening less or not. <img width="2059" height="91" alt="Image" src="https://github.com/user-attachments/assets/215ff329-144e-4dea-9b35-129b4c8d1383" />
Author
Owner

@rekram1-node commented on GitHub (Dec 12, 2025):

@DamianPereira yeah this is an upstream bug for us, our kimi k2 thinking provider (for zen) has a bug on their end, once they fix it this should resolve.

Basically if I enable proper interleaved thinking for kimi k2 thinking on their inference rn, it would loop infinitely (bug on their end), so rn I can't use interleaved thinking for it yet which is why sometimes it does dumb stuff like what you are seeing there.

@rekram1-node commented on GitHub (Dec 12, 2025): @DamianPereira yeah this is an upstream bug for us, our kimi k2 thinking provider (for zen) has a bug on their end, once they fix it this should resolve. Basically if I enable proper interleaved thinking for kimi k2 thinking on their inference rn, it would loop infinitely (bug on their end), so rn I can't use interleaved thinking for it yet which is why sometimes it does dumb stuff like what you are seeing there.
Author
Owner

@rekram1-node commented on GitHub (Dec 12, 2025):

I'll update once it has been addressed!

@rekram1-node commented on GitHub (Dec 12, 2025): I'll update once it has been addressed!
Author
Owner

@DamianPereira commented on GitHub (Dec 12, 2025):

Thanks a lot for the fix and quick answer.

@DamianPereira commented on GitHub (Dec 12, 2025): Thanks a lot for the fix and quick answer.
Author
Owner

@Adictya commented on GitHub (Dec 12, 2025):

can confirm the fix is working beautifully, thanks 👍🏻

@Adictya commented on GitHub (Dec 12, 2025): can confirm the fix is working beautifully, thanks 👍🏻
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2355