[BUG] Task Tool Fails with "Tool names must be unique" Error {Task Agents}

Resolved 💬 3 comments Opened Nov 1, 2025 by shashankshekharraj Closed Nov 4, 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?

Task Tool Fails with Tool Names Must Be Unique Error

Bug Description

The Task tool consistently fails with a 400 Bad Request error containing the message "tools: Tool names must be unique" for all subagent types including Explore, Plan, and general-purpose. This makes parallel and sequential agent execution completely impossible.

Environment

  • Claude Code Version: Latest as of November 1, 2025
  • Model: claude-sonnet-4-5-20250929
  • Platform: Windows
  • Working Directory: Valid git repository

Reproduction Steps

All of the following Task invocations fail with identical error:

Attempt 1: Multiple Parallel Agents (4 agents)

Launching 4 agents in parallel - ALL FAIL

  • Task with subagent_type="Explore", description="Agent 1", model="sonnet"
  • Task with subagent_type="Explore", description="Agent 2", model="sonnet"
  • Task with subagent_type="general-purpose", description="Agent 3", model="sonnet"
  • Task with subagent_type="Plan", description="Agent 4", model="haiku"

Attempt 2: Single Sequential Agent

Just ONE agent - ALSO FAILS

  • Task with subagent_type="Explore", description="Single agent", model="sonnet"

Attempt 3: Different Subagent Types

Tried all combinations - ALL FAIL

  • Task with subagent_type="general-purpose" - FAILED
  • Task with subagent_type="Plan" - FAILED
  • Task with subagent_type="Explore" - FAILED

Expected Behavior

Task tool should spawn subagents that can:

  • Execute complex multi-step analysis tasks
  • Run in parallel for performance
  • Run sequentially for coordinated workflows

Actual Behavior

Every single Task invocation fails immediately with error type "invalid_request_error" and message "tools: Tool names must be unique."

HTTP Status: 400 Bad Request

Impact

  • Severity: CRITICAL
  • Workaround Required: Must use direct tool calls like Read, Grep, Glob instead of Task agents
  • User Experience: Significantly degraded - manual analysis required instead of automated agent workflows
  • Performance: Cannot leverage parallel agent execution for complex tasks

Additional Context

  1. All other tools work perfectly:
  • Read, Write, Grep, Glob, Bash, TodoWrite all work fine
  • Only Task is completely non-functional
  1. Error occurs immediately:
  • Not a timeout or execution error
  • Fails before agent even spawns
  • Suggests internal tool registration or cleanup issue
  1. 100 percent reproducible:
  • Every Task invocation fails
  • No successful executions observed
  • Consistent across all subagent types and models
  1. Request IDs vary but error is identical across multiple attempts

Root Cause Hypothesis

The error message "Tool names must be unique" suggests:

  1. Internal tool name collision when spawning Task agents
  2. Incomplete cleanup of tool registrations between agent invocations
  3. Session-level state issue where tool names are not properly scoped per agent

Suggested Investigation

  1. Check tool registration mechanism in Task agent spawning logic
  2. Verify tool name scoping per agent instance
  3. Ensure proper cleanup of tool registrations after agent termination
  4. Test with fresh session with no prior tool invocations

Workaround Currently Using

Instead of Task agents, using direct tool composition:
Instead of using Task with subagent_type="Explore" and prompt="Analyze files", using Glob then Read then Grep then manual analysis.

This works but loses the benefit of autonomous multi-step agent workflows.

Would appreciate fix as this blocks a major Claude Code feature.

What Should Happen?

Multi Task Agents should be activated

Error Messages/Logs

Steps to Reproduce

Task Tool Fails with Tool Names Must Be Unique Error

Bug Description

The Task tool consistently fails with a 400 Bad Request error containing the message "tools: Tool names must be unique" for all subagent types including Explore, Plan, and general-purpose. This makes parallel and sequential agent execution completely impossible.

Environment

  • Claude Code Version: Latest as of November 1, 2025
  • Model: claude-sonnet-4-5-20250929
  • Platform: Windows
  • Working Directory: Valid git repository

Reproduction Steps

All of the following Task invocations fail with identical error:

Attempt 1: Multiple Parallel Agents (4 agents)

Launching 4 agents in parallel - ALL FAIL

  • Task with subagent_type="Explore", description="Agent 1", model="sonnet"
  • Task with subagent_type="Explore", description="Agent 2", model="sonnet"
  • Task with subagent_type="general-purpose", description="Agent 3", model="sonnet"
  • Task with subagent_type="Plan", description="Agent 4", model="haiku"

Attempt 2: Single Sequential Agent

Just ONE agent - ALSO FAILS

  • Task with subagent_type="Explore", description="Single agent", model="sonnet"

Attempt 3: Different Subagent Types

Tried all combinations - ALL FAIL

  • Task with subagent_type="general-purpose" - FAILED
  • Task with subagent_type="Plan" - FAILED
  • Task with subagent_type="Explore" - FAILED

Expected Behavior

Task tool should spawn subagents that can:

  • Execute complex multi-step analysis tasks
  • Run in parallel for performance
  • Run sequentially for coordinated workflows

Actual Behavior

Every single Task invocation fails immediately with error type "invalid_request_error" and message "tools: Tool names must be unique."

HTTP Status: 400 Bad Request

Impact

  • Severity: CRITICAL
  • Workaround Required: Must use direct tool calls like Read, Grep, Glob instead of Task agents
  • User Experience: Significantly degraded - manual analysis required instead of automated agent workflows
  • Performance: Cannot leverage parallel agent execution for complex tasks

Additional Context

  1. All other tools work perfectly:
  • Read, Write, Grep, Glob, Bash, TodoWrite all work fine
  • Only Task is completely non-functional
  1. Error occurs immediately:
  • Not a timeout or execution error
  • Fails before agent even spawns
  • Suggests internal tool registration or cleanup issue
  1. 100 percent reproducible:
  • Every Task invocation fails
  • No successful executions observed
  • Consistent across all subagent types and models
  1. Request IDs vary but error is identical across multiple attempts

Root Cause Hypothesis

The error message "Tool names must be unique" suggests:

  1. Internal tool name collision when spawning Task agents
  2. Incomplete cleanup of tool registrations between agent invocations
  3. Session-level state issue where tool names are not properly scoped per agent

Suggested Investigation

  1. Check tool registration mechanism in Task agent spawning logic
  2. Verify tool name scoping per agent instance
  3. Ensure proper cleanup of tool registrations after agent termination
  4. Test with fresh session with no prior tool invocations

Workaround Currently Using

Instead of Task agents, using direct tool composition:
Instead of using Task with subagent_type="Explore" and prompt="Analyze files", using Glob then Read then Grep then manual analysis.

This works but loses the benefit of autonomous multi-step agent workflows.

Would appreciate fix as this blocks a major Claude Code feature.

Claude Model

Not sure / Multiple models

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

Windows

Terminal/Shell

PyCharm terminal

Additional Information

_No response_

View original on GitHub ↗

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