Custom Tools Failing with TypeError #9199

Open
opened 2026-02-16 18:11:53 -05:00 by yindo · 3 comments
Owner

Originally created by @CyberSecDef on GitHub (Feb 12, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

This is happening on both Windows and RHEL installs. any call to a custom tool (global or project specific) results in a TypeError: text2.split is not a function error message. This is based off clean installs that are fully updated. There are no custom plugins used. This is also occuring with local LLMs and commerical ones like Google Gemini. This is impacting all tools, even ones copy/pasted from the documentation (math - add).

Plugins

NA

OpenCode version

1.1.63

Steps to reproduce

  1. launch opencode
  2. Connect to LLM service
  3. prompt with something like "use the math-add tool to add the numbers 5 and 7"
  4. Recieve response:
    ⚙ math_add [a=5, b=7]
    TypeError: text2.split is not a function. (In 'text2.split( )', 'text2.split' is undefined)

the custom tool does not have text2 variable or split method calls in the code. no other 'source' data is outputted, so this is really hard to trace down

Screenshot and/or share link

No response

Operating System

RHEL 8, Windows 11

Terminal

Putty and Windows Terminal

Originally created by @CyberSecDef on GitHub (Feb 12, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description This is happening on both Windows and RHEL installs. any call to a custom tool (global or project specific) results in a TypeError: text2.split is not a function error message. This is based off clean installs that are fully updated. There are no custom plugins used. This is also occuring with local LLMs and commerical ones like Google Gemini. This is impacting all tools, even ones copy/pasted from the documentation (math - add). ### Plugins NA ### OpenCode version 1.1.63 ### Steps to reproduce 1. launch opencode 2. Connect to LLM service 3. prompt with something like "use the math-add tool to add the numbers 5 and 7" 4. Recieve response: ⚙ math_add [a=5, b=7] TypeError: text2.split is not a function. (In 'text2.split(` `)', 'text2.split' is undefined) ***the custom tool does not have text2 variable or split method calls in the code. no other 'source' data is outputted, so this is really hard to trace down*** ### Screenshot and/or share link _No response_ ### Operating System RHEL 8, Windows 11 ### Terminal Putty and Windows Terminal
yindo added the windowsbug labels 2026-02-16 18:11:53 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 12, 2026):


This issue might be a duplicate of or related to existing tool-execution TypeErrors. Please check:

  • #12336: Bug: Zod TypeError when loading custom tools from .opencode directory
  • #12987: Kubernetes MCP server tools fail with TypeError: output.output.toLowerCase()
  • #13042: MCP tools crash: TypeError on value.output.output in processor.ts
  • #13062: opencode MCP TypeError (similar pattern)

The text2.split is not a function error pattern is similar to other reported .split is not a function crashes in tool handling code (#4484, #4869).

If this is indeed a duplicate, the maintainers may consolidate these reports.

@github-actions[bot] commented on GitHub (Feb 12, 2026): --- This issue might be a duplicate of or related to existing tool-execution TypeErrors. Please check: - #12336: Bug: Zod TypeError when loading custom tools from .opencode directory - #12987: Kubernetes MCP server tools fail with TypeError: output.output.toLowerCase() - #13042: MCP tools crash: TypeError on value.output.output in processor.ts - #13062: opencode MCP TypeError (similar pattern) The `text2.split is not a function` error pattern is similar to other reported `.split is not a function` crashes in tool handling code (#4484, #4869). If this is indeed a duplicate, the maintainers may consolidate these reports.
Author
Owner

@CyberSecDef commented on GitHub (Feb 12, 2026):

This shouldn't be #12336 as this happens for both global and project level tools
This shouldnt be #12987 as this isn't an MCP tool, rather a custom tool (.opencode/tools/math.ts)
This should be #13042 as this is a custom tool
This shouldnt be #13062 as this is a custom tool
This isnt #4484 as there are no sub commands given on the command line
This isn't #4869 as it is happening with one of the latest releases.

@CyberSecDef commented on GitHub (Feb 12, 2026): This shouldn't be #12336 as this happens for both global and project level tools This shouldnt be #12987 as this isn't an MCP tool, rather a custom tool (.opencode/tools/math.ts) This should be #13042 as this is a custom tool This shouldnt be #13062 as this is a custom tool This isnt #4484 as there are no sub commands given on the command line This isn't #4869 as it is happening with one of the latest releases.
Author
Owner

@CyberSecDef commented on GitHub (Feb 12, 2026):

it appears that if the tool returns just a string, it works. might be worth updating the custom tool documentation to state that. returning numbers or objects is a trigger for this issue.

@CyberSecDef commented on GitHub (Feb 12, 2026): it appears that if the tool returns just a string, it works. might be worth updating the custom tool documentation to state that. returning numbers or objects is a trigger for this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9199