Skip to content

[BUG] tools[21].function.name': string too long. Expected a string with maximum length 64, but got a string with length 65 instead. #3523

Closed as not planned

Description

@Racle

Description

Tool name is too long. This was taken from logs.
Opencode does not send any error message to TUI, it just will die silently.
And it also do not process any more request when tool name is too long, even when unrelated to MCP servers.

Might be related to this: https://github.com/sst/opencode/blob/a0541ba57aebcdb21c36540f0efd8a251fdbc2b8/packages/opencode/src/mcp/index.ts#L207-L209

This generates tool name from mcp name + tool name.
It would be better to set that max size to 64 characters to fix this issue.

Same issue was in ravitemer/mcphub.nvim#243 and limiting tool length fixed it. In difference, mcphub.nvim throws an error to user.

OpenCode version

0.15.23

Steps to reproduce

  1. Change MCP server to long name (60+ characters)
  2. Try to use opencode with any MCP server
  3. Opencode will just die silently after running "generating" for second

Screenshot and/or share link

Image

Operating System

Pop_os 22.04.

Terminal

Kitty, tmux, nvim with sidekick.nvim

Activity

  1. changed the title [-]tools[21].function.name': string too long. Expected a string with maximum length 64, but got a string with length 65 instead.[/-] [+][BUG] tools[21].function.name': string too long. Expected a string with maximum length 64, but got a string with length 65 instead.[/+] on Oct 29, 2025
  2. github-actions commented on Oct 29, 2025

    @github-actions
    Contributor

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

    Both issues involve MCP server tool naming validation problems, though #3523 specifically mentions the 64-character length limit while the others mention pattern validation. The root cause appears related to how OpenCode generates tool names from MCP server names + tool names.

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

  3. rekram1-node commented on Oct 29, 2025

    @rekram1-node
    Contributor

    What provider gave that error?

  4. Racle commented on Oct 29, 2025

    @Racle
    Author

    What provider gave that error?

    Company internal MCP server. Tool names are generated and limited to ~50 characters.

  5. rekram1-node commented on Oct 29, 2025

    @rekram1-node
    Contributor

    @Racle but that error comes from an inference provider I thought, I don't think the ai sdk is throwing it (could be wrong tho)

    What inference provider was it? Openai? Google?

  6. Racle commented on Oct 29, 2025

    @Racle
    Author

    @Racle but that error comes from an inference provider I thought, I don't think the ai sdk is throwing it (could be wrong tho)

    What inference provider was it? Openai? Google?

    Test MCP config what can be used to test this:

    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "chrome-devtools-aaaaaaaaaaaaaaaaaaaaa": {
          "type": "local",
          "command": ["npx", "chrome-devtools-mcp@latest"]
        }
      }
    }
    
    
    

    I'm using GitHub Copilot GPT-4.1 as that is the only one I currently have access.

    I see the error in opencode log files (running this as opencode --log-level DEBUG ), but terminal client just dies silently. There is no error message.

    INFO  2025-10-29T16:10:59 +1ms service=session.prompt session=ses_5cf4368afffewe4wL4auBcU6OA type=error part
    ERROR 2025-10-29T16:10:59 +1ms service=session.prompt session=ses_5cf4368afffewe4wL4auBcU6OA error=Invalid 'tools[29].function.name': string too long. Expected a string with maximum length 64, but got a string with length 65 instead. process
    
    
  7. rekram1-node commented on Oct 29, 2025

    @rekram1-node
    Contributor

    good to know thanks!

  8. faizhasim commented on Nov 13, 2025

    @faizhasim

    I encounter similar issues when using any of the gpt models (from copilot) and docker mcp enabled. Other models (claude/gemini 2.5 pro) works fine.

    Image
  9. rekram1-node commented on Nov 13, 2025

    @rekram1-node
    Contributor

    Yeah if you are using too many tools they get upset, im not sure what we can do for u besides truncate the tools and give u an error or warning

  10. Br1an67 commented on Mar 1, 2026

    @Br1an67

    I'd like to work on this. The fix truncates the combined MCP server + tool name to 64 characters and logs a warning when truncation occurs.

    PR: #15595

  11. morpheus9393 commented on Mar 6, 2026

    @morpheus9393

    Samem problem here when using latest GPT-5.3 Codex in OC 1.2.18

    "Invalid 'input[].call_id': string too long. Expected a string with maximum length 64, but got a string with length 2507 instead."

  12. EvanDataForge commented on Mar 7, 2026

    @EvanDataForge

    I keep getting this error

    Invalid 'input[202].call_id': string too long. Expected a string with maximum length 64, but got a string with length 65 instead.

    using model: nvidia/moonshotai/kimi-k2.5, but also with openai/gpt5.3-codex

  13. morpheus9393 commented on Mar 7, 2026

    @morpheus9393

    It seems this bug mainly concers longr sessions. Started over with a new session with Codex-5.3 and there error does not appear.

  14. removed
    bugSomething isn't working
    on May 3, 2026
  15. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 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

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions