[Bug] /compact fails with "Tool names must be unique" even after disabling all MCP servers (v2.0.70)

Resolved 💬 5 comments Opened Dec 16, 2025 by gamguy08 Closed Dec 17, 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?

The /compact command fails with API Error 400: "tools: Tool names must be unique"
immediately after starting a new session.

This error persists even after:

  • Disabling all MCP servers via /mcp disable
  • Fresh session with minimal conversation

The bug was reportedly fixed in v2.0.31, but it has regressed in v2.0.70.

What Should Happen?

/compact should successfully compact the conversation without API errors,
regardless of MCP server status or custom agent/command configurations.

Error Messages/Logs

> /compact
    ⎿  Error: Error during compaction: Error: API Error: 400
       {"type":"error","error":{"type":"invalid_request_error",
       "message":"tools: Tool names must be unique."},
       "request_id":"req_011CW9cz13pCHJv2SC8NPCaq"}

  After disabling MCP:
  > /mcp disable
    ⎿  Disabled 3 MCP server(s)

  > /compact
    ⎿  Error: Error during compaction: Error: API Error: 400
       {"type":"error","error":{"type":"invalid_request_error",
       "message":"tools: Tool names must be unique."},
       "request_id":"req_011CW9cz13pCHJv2SC8NPCaq"}

Steps to Reproduce

  1. Start Claude Code v2.0.70
  2. Have custom agents (20) and slash commands (56) configured in ~/.claude/
  3. Run any command (even simple greeting like "hello")
  4. Execute /compact
  5. Error occurs: "tools: Tool names must be unique"

Alternative test:

  1. Run /mcp disable to disable all MCP servers (3 servers disabled)
  2. Run /compact
  3. Same error still occurs

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.0.70

Claude Code Version

  • Claude Code version: 2.0.70

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

  • This appears to be a regression. The same issue was fixed in v2.0.31 (Issue #10668)
  • The error occurs even with 0 MCP servers active
  • Custom slash commands follow a pattern: /command and /sc:command (e.g., /analyze and /sc:analyze)
  • Custom agents are defined in ~/.claude/agents/*.md files
  • Possibly related to tool deduplication logic during compaction subprocess

Related issues:

  • #10668 (original fix in v2.0.31)
  • #10697 (duplicate)
  • #10761 (similar recent report)

View original on GitHub ↗

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