[BUG] Subagent deployment fails with "Tool names must be unique" error when using VS Code extension

Resolved 💬 3 comments Opened Oct 31, 2025 by AndreasSpannbauer Closed Oct 31, 2025

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Description:

When attempting to deploy subagents using the Task tool from within the
Claude Code VS Code extension, all subagent deployments fail with the
following error:

API Error: 400
{"type":"error","error":{"type":"invalid_request_error","message":"tools:
Tool names must be unique."},"request_id":"req_..."}

Environment:

  • Claude Code VS Code Extension: 2.0.30
  • VS Code Version: 1.105.1 (x64)
  • OS: Ubuntu 24.04.3 LTS (Noble)
  • Kernel: 6.14.0-33-generic
  • Claude Code CLI Version: 2.0.30

Workarounds Found:

✅ Works: Running Claude Code from terminal (not VS Code extension)
claude
# Then deploy subagent - works fine

✅ Works: Running VS Code with Claude extension disabled
code --disable-extensions /path/to/project
# Then deploy subagent - works fine

❌ Fails: Running Claude Code from within VS Code with extension enabled

Root Cause Analysis:

The Claude Code VS Code extension appears to register MCP tools that
conflict with subagent tool definitions. When a subagent is spawned from
within the VS Code extension session, it inherits the parent session's tool
definitions, creating duplicate registrations.

Impact:

This completely blocks the use of subagents (Task tool) when working within
the VS Code extension, which is a critical feature for complex, multi-step
workflows.

Suggested Fix:

The VS Code extension should either:

  1. Isolate subagent tool namespaces from the parent session
  2. Not pass MCP tool configurations down to subagents
  3. Detect and prevent duplicate tool registrations before making the API

call

Additional Context:

  • This issue persists even after:
  • Removing all MCP servers (claude mcp remove)
  • Clearing .mcp.json, .claude/mcp.json, and ~/.mcp.json
  • Rebooting the system
  • Restarting VS Code
  • The error only occurs when the Claude Code VS Code extension is active
  • This appears to be an extension-specific issue, not a Claude Code CLI

issue

What Should Happen?

Expected Behavior:
Subagent should deploy successfully and execute the task.

Error Messages/Logs

Actual Behavior:
  Subagent deployment fails immediately with duplicate tool name error.

  API Error: 400
  {"type":"error","error":{"type":"invalid_request_error","message":"tools:
  Tool names must be unique."},"request_id":"req_..."}

Steps to Reproduce

Steps to Reproduce:

  1. Open VS Code with Claude Code extension enabled
  2. Start a Claude Code session in any project
  3. Attempt to deploy a subagent using the Task tool:

Task(
subagent_type="general-purpose",
description="Write simple test file",
prompt="Create a test markdown file at /tmp/test.md"
)

  1. Observe the "Tool names must be unique" error

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.30

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗