claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Invalid Tool Name: Regex Validation Failure for Custom Tool Name

Open kiranags opened this issue 9 months ago • 7 comments

Bug Description API Error: 400 {"type":"error","error":{"type":"invalid_request_error", "message":"tools.15.custom.name: String should match pattern '^[a-zA-Z0-9_-]{1,64}$'"}}

Environment Info

  • Platform: macos
  • Terminal: Apple_Terminal
  • Version: 0.2.103
  • Feedback ID: 751e296f-8693-4ae5-a3fa-92ee1de64c91

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at genericNodeError (node:internal/errors:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:882:11)\n    at execSync (node:child_process:954:15)\n    at JX (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:617:3348)\n    at file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:512:16277\n    at D (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:502:12863)\n    at zW (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:512:15798)\n    at Gw6 (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2032:21144)\n    at file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2170:635","timestamp":"2025-05-07T08:52:30.851Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"tools.15.custom.name: String should match pattern '^[a-zA-Z0-9_-]{1,64}$'\"}}\n    at s5.generate (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:689:2210)\n    at D3.makeStatusError (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:693:7240)\n    at D3.makeRequest (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:693:8185)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-05-07T08:52:32.192Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"tools.15.custom.name: String should match pattern '^[a-zA-Z0-9_-]{1,64}$'\"}}\n    at s5.generate (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:689:2210)\n    at D3.makeStatusError (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:693:7240)\n    at D3.makeRequest (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:693:8185)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async Ah.showErrors (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1554:15367)\n    at async Ah (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1554:9871)\n    at async gY6 (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1554:15215)\n    at async aa1 (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1554:4715)\n    at async ea1 (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1554:13846)\n    at async Ln5 (file:///Users/kiranags/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1878:180)","timestamp":"2025-05-07T08:52:32.539Z"}]

kiranags avatar May 07 '25 08:05 kiranags

Same here,  API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools.203.custom.name: String should match pattern '^[a-zA-Z0-9_-]{1,64}$'"}}

slavag avatar May 29 '25 08:05 slavag

Same here

zereight avatar May 29 '25 13:05 zereight

In my case, it is mcp issue.

zereight avatar May 29 '25 13:05 zereight

It's in everyone case

slavag avatar May 29 '25 13:05 slavag

Check your some mcp serve has wrong tool name, like "get_content " (space)

zereight avatar May 29 '25 13:05 zereight

Well in my case all mcp are working in claude desktop and imported by claude code from there.

slavag avatar May 29 '25 14:05 slavag

Hi, Facing this issue as well. In my case, my MCP server exposes tools whose names contain a / (eg- github/git_commit). This is because I'm building an MCP Proxy. I'm getting this error for both Claude Desktop & Code. This is directly due to the restriction from the RegExp. Can the regexp be made more permissive? I don't think having a slash in tool names should be a problem.

duaraghav8 avatar Jun 15 '25 09:06 duaraghav8

Running into this issue as well. For me it was the CircleCI MCP Server which looks like it's already filed a bug https://github.com/CircleCI-Public/mcp-server-circleci/issues/109

MinesJA avatar Jul 25 '25 17:07 MinesJA

Fix landing as part of tomorrow's release

bcherny avatar Aug 15 '25 18:08 bcherny

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 23 '25 14:08 github-actions[bot]