[BUG] Model misinterprets tool_result replay as user input

Resolved 💬 3 comments Opened Mar 11, 2026 by hejin737 Closed Mar 15, 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?

Environment

  • Claude Code CLI: v2.1.72
  • Model: claude-sonnet-4-5-20250929

Description

In SDK mode, --replay-user-messages is auto-enabled, causing tool_result
messages to be echoed back as type=user messages. The model sometimes
misinterprets these tool_result messages as actual user input.

What Should Happen?

The model should recognize tool_result content blocks as tool execution
results, not as new user input. This confusion wastes a reasoning turn
and produces incorrect thinking.

Error Messages/Logs

Steps to Reproduce

  1. Start CLI send a simple prompt like "who are u"
  2. Model calls ToolSearch tool
  3. CLI echoes tool_result as type=user:

```json
{
"type": "user",
"message": {
"role": "user",
"content": [{"type": "tool_result", "tool_use_id": "...",
"content": [{"type": "tool_reference", "tool_name": "Read"}]}]
},
"tool_use_result": {"matches": ["Read"], "query": "select:Read"}
}

  1. Model's next thinking block says: "The user only sent a . "

— clearly misinterpreting the tool_result

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

v2.1.72

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

This is 100% reproducible with claude-sonnet-4-5-20250929. Every time
the model calls a tool (e.g. ToolSearch, Read), it misinterprets the
subsequent tool_result replay as a new user message in its thinking block.

This suggests it may be a model-level issue specific to sonnet-4-5, where
the model fails to distinguish tool_result content blocks from actual
user text input when both arrive as role: "user" messages.

View original on GitHub ↗

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