[BUG] ToolSearch:optimistic logging spam causes session freeze (v2.1.19)

Resolved 💬 3 comments Opened Jan 26, 2026 by mudhuh Closed Jan 30, 2026

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?

In version 2.1.19, the [ToolSearch:optimistic] debug logging runs in a loop, generating 89,000+ identical log entries in
a single session (88% of total debug log). This causes the session to freeze/hang while actual tool usage remains normal
(255 Bash, 37 Read, 26 Edit calls).

Debug log sample shows thousands of repeated lines within milliseconds:
2026-01-26T12:55:17.131Z [DEBUG] [ToolSearch:optimistic] mode=tst-auto, ENABLE_TOOL_SEARCH=undefined, result=true
2026-01-26T12:55:17.131Z [DEBUG] [ToolSearch:optimistic] mode=tst-auto, ENABLE_TOOL_SEARCH=undefined, result=true
(repeated ~89,000 times)

Environment: Linux, Claude Code 2.1.19

What Should Happen?

The [ToolSearch:optimistic] check should run once per tool call, not thousands of times in a loop. Debug logs should
remain manageable in size and the session should not freeze due to logging overhead.

Error Messages/Logs

Steps to Reproduce

  1. Start a new Claude Code session in a large Rails codebase
  2. Give a task that requires multiple tool calls (e.g., "find all usages of X and update them")
  3. Session freezes/hangs after several minutes
  4. Check debug log at ~/.claude/debug/<session-id>.txt - shows 89,000+ repeated ToolSearch:optimistic entries

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.19 (Claude Code)

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 ↗