Skip to content

Error "reasoning part reasoning-0 not found" from tool calls using GLM 4.5 Air #6486

Closed

Description

@jhov94

Description

I just updated OpenCode from v1.0.163 to v1.0.218 and now tool calls using GLM 4.5 Air result in an error "reasoning part reasoning-0 not found". Prior to updating OpenCode the model had no issues calling tools. It appears that the tool calls finish and the model is able to see the results of the tool call, but is not able to respond. If prompted to continue, it was able to respond as if no error occurred for a while until eventually every prompt to continue resulted in the error.

OpenCode version

1.0.218

Steps to reproduce

  1. Load GLM 4.5 Air (I'm using LMStudio locally)
  2. Have the model attempt a tool call

Screenshot and/or share link

Image

Operating System

Windows 10

Terminal

Powershell 7

Activity

  1. github-actions commented on Dec 30, 2025

    @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 Dec 30, 2025

    @rekram1-node
    Collaborator

    cann u share your config?

  3. jhov94 commented on Dec 30, 2025

    @jhov94
    Author

    I also tried it with no options defined for the model since I'm not sure if those options are model specific or not. Here's my config:

    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "lmstudio": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "LM Studio (local)",
          "options": {
            "baseURL": "http://192.168.0.2:1234/v1"
          },
          "models": {
            "qwen3-30b-a3b-thinking-2507": {
              "name": "Qwen3 30B A3B Thinking 2507",
    	         "options": {
                "reasoningEffort": "high",
                "textVerbosity": "low",
                "reasoningSummary": "auto",
                }
            },
            "qwen3-coder-30b-a3b-instruct": {
             "name": "Qwen3 Coder 30B A3B Instruct"
            },
            "gpt-oss-120b": {
             "name": "GPT OSS 120B",
             "options": {
                      "reasoningEffort": "high",
                      "textVerbosity": "low",
                      "reasoningSummary": "auto",
             }
            },
            "bytedance/seed-oss-36b": {
             "name": "Seed OSS 36B",
             "options": {
                      "reasoningEffort": "high",
                      "textVerbosity": "low",
                      "reasoningSummary": "auto",
             }
            },
            "glm-4.5-air": {
             "name": "GLM 4.5 Air",
             "options": {
                      "reasoningEffort": "high",
                      "textVerbosity": "low",
                      "reasoningSummary": "auto",
             }
            },
            "mistralai/devstral-small-2-2512": {
             "name": "Devstrall 2 Small 2512",
             "options": {
                      "reasoningEffort": "high",
                      "textVerbosity": "low",
                      "reasoningSummary": "auto",
             }
            },
            "arliai_glm-4.5-air-derestricted": {
             "name": "GLM 4.5 Air Derestricted",
            "options": {
                      "reasoningEffort": "high",
                      "textVerbosity": "low",
                      "reasoningSummary": "auto",
             }
            },
            "kwaipilot_kat-dev": {
             "name": "Kat-Dev",
             "options": {
                      "reasoningEffort": "high",
                      "textVerbosity": "low",
                      "reasoningSummary": "auto",
             }
            },
            "gpt-oss-20b": {
             "name": "GPT OSS 20B",
             "options": {
                      "reasoningEffort": "high",
                      "textVerbosity": "low",
                      "reasoningSummary": "auto",
             }
            },
            "nemotron-3-nano-30b-a3b": {
             "name": "Nemotron 3 Nano 30B",
             "options": {
                      "reasoningEffort": "high",
                      "textVerbosity": "low",
                      "reasoningSummary": "auto",
             }
    
            }
          }
        }
      },
    
      "keybinds": {
        "leader": "ctrl+z",
        "app_exit": "ctrl+c,ctrl+d,<leader>q",
        "editor_open": "<leader>e",
        "theme_list": "<leader>t",
        "sidebar_toggle": "<leader>b",
        "username_toggle": "none",
        "status_view": "<leader>s",
        "session_export": "<leader>x",
        "session_new": "<leader>n",
        "session_list": "<leader>l",
        "session_timeline": "<leader>g",
        "session_share": "none",
        "session_unshare": "none",
        "session_interrupt": "escape",
        "session_compact": "<leader>c",
        "session_child_cycle": "<leader>+right",
        "session_child_cycle_reverse": "<leader>+left",
        "messages_page_up": "pageup",
        "messages_page_down": "pagedown",
        "messages_half_page_up": "ctrl+alt+u",
        "messages_half_page_down": "ctrl+alt+d",
        "messages_first": "ctrl+g,home",
        "messages_last": "ctrl+alt+g,end",
        "messages_copy": "<leader>y",
        "messages_undo": "<leader>u",
        "messages_redo": "<leader>r",
        "messages_last_user": "none",
        "messages_toggle_conceal": "<leader>h",
        "model_list": "<leader>m",
        "model_cycle_recent": "f2",
        "model_cycle_recent_reverse": "shift+f2",
        "command_list": "ctrl+p",
        "agent_list": "<leader>a",
        "agent_cycle": "tab",
        "agent_cycle_reverse": "shift+tab",
        "input_clear": "ctrl+c",
        "input_paste": "ctrl+v",
        "input_submit": "return",
        "input_newline": "shift+return,ctrl+return,alt+return,ctrl+j",
        "input_move_left": "left,ctrl+b",
        "input_move_right": "right,ctrl+f",
        "input_move_up": "up",
        "input_move_down": "down",
        "input_select_left": "shift+left",
        "input_select_right": "shift+right",
        "input_select_up": "shift+up",
        "input_select_down": "shift+down",
        "input_line_home": "ctrl+a",
        "input_line_end": "ctrl+e",
        "input_select_line_home": "ctrl+shift+a",
        "input_select_line_end": "ctrl+shift+e",
        "input_visual_line_home": "alt+a",
        "input_visual_line_end": "alt+e",
        "input_select_visual_line_home": "alt+shift+a",
        "input_select_visual_line_end": "alt+shift+e",
        "input_buffer_home": "home",
        "input_buffer_end": "end",
        "input_select_buffer_home": "shift+home",
        "input_select_buffer_end": "shift+end",
        "input_delete_line": "ctrl+shift+d",
        "input_delete_to_line_end": "ctrl+k",
        "input_delete_to_line_start": "ctrl+u",
        "input_backspace": "backspace,shift+backspace",
        "input_delete": "ctrl+d,delete,shift+delete",
        "input_undo": "ctrl+-,super+z",
        "input_redo": "ctrl+.,super+shift+z",
        "input_word_forward": "alt+f,alt+right,ctrl+right",
        "input_word_backward": "alt+b,alt+left,ctrl+left",
        "input_select_word_forward": "alt+shift+f,alt+shift+right",
        "input_select_word_backward": "alt+shift+b,alt+shift+left",
        "input_delete_word_forward": "alt+d,alt+delete,ctrl+delete",
        "input_delete_word_backward": "ctrl+w,ctrl+backspace,alt+backspace",
        "history_previous": "up",
        "history_next": "down",
        "terminal_suspend": "ctrl+z"
      }
    }
    
  4. onurakman commented on Jan 2, 2026

    @onurakman

    I got the same error with GLM-4.5-Air after upgrading to v1.0.223

    Sometimes GLM outputs <think></think> empty tags with may be this is causing problem

  5. onurakman commented on Jan 5, 2026

    @onurakman

    I tried with version 1.1.2 and the problem still exits. The change added in version 1.0.218 #6463 causes problems with GLM models.

  6. jnvitr commented on Jan 6, 2026

    @jnvitr

    Also having this error with GLM 4.5 Air on latest opencode on win. Running model local FP8

  7. rekram1-node commented on Jan 6, 2026

    @rekram1-node
    Collaborator

    ahh

  8. arkamar commented on Jan 9, 2026

    @arkamar

    I am having the same issue with 1.1.8. I reverted the #6463 locally and the issue really seems to be gone, however, the thinking block is not differentiated from the response (the ... is part of the response). In my case I run GLM 4.6V Flash in llama.cpp.

  9. rmhubbert commented on Jan 24, 2026

    @rmhubbert

    I'm seeing this as well, but only on vLLM. My llama.cpp version does not throw the error.

    In vLLM, the error is thrown on the first tool call attempt.

    I'm running https://huggingface.co/cyankiwi/GLM-4.5-Air-AWQ-4bit via vLLM v0.14.0, with Opencode v1.1.34 on an up to date Arch Linux.

    EDIT: I'm also seeing the error when using https://huggingface.co/QuantTrio/GLM-4.5-Air-AWQ-FP16Mix in vLLM.

    My vLLM config is as follows (via llama-swap)

    "glm-4.5-air":
        name: "GLM 4.5 Air"
        ttl: 1800
        env:
          - "OMP_NUM_THREADS=4"
          - "CUDA_DEVICE_ORDER=PCI_BUS_ID"
          - "CUDA_VISIBLE_DEVICES=0,1,4,5"
          - "CUDA_HOME=/opt/cuda"
          - "PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True"
          - "HF_TOKEN=${HF_TOKEN}"
        cmd: |
          uv run vllm serve cyankiwi/GLM-4.5-Air-AWQ-4bit
          --served-model-name glm-4.5-air
          --max-model-len auto
          --host 0.0.0.0
          --port ${PORT}
          --seed 3407
          --tensor-parallel-size 4
          --enable-expert-parallel
          --tool-call-parser glm45
          --reasoning-parser glm45
          --enable-auto-tool-choice
          --disable-custom-all-reduce
          --max-num-seqs 8
          --gpu-memory-utilization 0.95

    My working llama.cpp config is as follows

    "glm-4.5-air-llama":
        name: "GLM 4.5 Air Llama"
        ttl: 1800
        cmd: |
          llama-server --host 0.0.0.0 --port ${PORT}
          --flash-attn on
          --fit on
          --fit-target 512
          --seed 3407
          --prio 2
          --threads 12
          --threads-batch 12
          --main-gpu 1
          --parallel 1
          --no-mmap
          --mlock
          --jinja
          --model models/GLM-4.5-Air-UD-Q6_K_XL-00001-of-00003.gguf
          --chat-template-file ./templates/glm-4.5-air-chat-template.jinja
          --ctx-size 98304
          --batch-size 4096
          --ubatch-size 2048
          --temp 0.6
          --top-p 0.95
          --top-k 40

    The relevant part of my opencode.json

    "provider": {
      "llama.cpp": {
        "npm": "@ai-sdk/openai-compatible",
        "name": "Llama.cpp",
        "options": {
          "baseURL": "http://localhost/v1"
        },
        "models": {
          "glm-4.5-air": {
            "name": "GLM 4.5 Air",
            "reasoning": true,
            "tool_call": true,
            "temperature": true,
            "open_weights": true,
            "modalities": {
              "input": ["text"],
              "output": ["text"]
            },
            "cost": {
              "input": 0,
              "output": 0,
              "cache_read": 0
            },
            "limit": {
              "context": 98304,
              "output": 98304
            }
          }
       }
    }
  10. mkondakov commented on Jan 26, 2026

    @mkondakov

    I have the same issue
    My setup:
    opencode v1.1.36 on mac
    LM Studio 0.3.39 + zai-org/glm-4.6v-flash on windows

  11. vim-reaper commented on Jan 26, 2026

    @vim-reaper

    Downgrading to v1.0.201 is a workaround.

  12. arkamar commented on Jan 27, 2026

    @arkamar

    @rmhubbert I am wondering, is the different result related to different templates used in vLLM and llama.cpp? I noticed the --chat-template-file ./templates/glm-4.5-air-chat-template.jinja parameter in your llama.cpp command. I am having this issue with default template in llama.cpp and you have the same issue in vLLM, which most probably runs also with default template, right?

  13. jovanwongzixi commented on Jan 27, 2026

    @jovanwongzixi

    This issue is due to the LLM endpoint returning an empty thinking block that is not parsed correctly in the extractReasoningMiddleware function in the Vercel AI module. I have submitted a PR in Vercel's ai repo detailing the fix, which you can implement yourself in the meantime too.

    The PR can be found at vercel/ai#12055

  14. rmhubbert commented on Jan 30, 2026

    @rmhubbert

    Thanks @jovanwongzixi, much appreciated!

    @arkamar It was definitely worth a shot, but unfortunately, running my vLLM instances with the same explicit template file didn't make any difference.

  15. jovanwongzixi commented on Jan 31, 2026

    @jovanwongzixi

    Update: The PR has been approved and included in the latest release of the ai SDK (v6.0.64).

    However, opencode is using v5.0.124 at the time of writing, and based on my previous tests while patching, v6.0.0 onwards introduces changes that will break opencode. I have not looked into detail on what's the issue (and if the issue still exists).

    I worked around by patching v5.0.119 and linked the local patch to opencode.

  16. rmhubbert commented on Feb 2, 2026

    @rmhubbert

    Interesting! Something has changed with Opencode 1.1.48. I noticed that the ai-sdk library version was bumped to the latest v5 version, so maybe @jovanwongzixi's fix was backported to v5?

    Anyway, I am no longer seeing the original reasoning part reasoning-0 not found error after tool calls when running GLM 4.5 Air on vLLM. There is a new issue; All output after the initial tool call is wrapped in <think></think> tags, but the task does now complete.

  17. jovanwongzixi commented on Feb 2, 2026

    @jovanwongzixi

    Interesting! Something has changed with Opencode 1.1.48. I noticed that the ai-sdk library version was bumped to the latest v5 version, so maybe @jovanwongzixi's fix was backported to v5?

    Anyway, I am no longer seeing the original reasoning part reasoning-0 not found error after tool calls when running GLM 4.5 Air on vLLM. There is a new issue; All output after the initial tool call is wrapped in <think></think> tags, but the task does now complete.

    Are you able to share more details on how to replicate the issue and/or possibly some screenshots? I'm unlikely to have time to look into this anytime soon but it could possibly help others who are willing to take a look at it 😄

  18. github-actions commented on Apr 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

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 workingwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions