[BUG] WebSearch tool always fails with "400 Input is too long for requested model" on claude-opus-4-6

Resolved 💬 3 comments Opened Apr 13, 2026 by yanghl96 Closed Apr 16, 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?

Description

The built-in WebSearch tool consistently fails with the following error regardless of query length or content:

API Error: 400 Input is too long for requested model

## Environment

  • OS: macOS 22.6.0 (Darwin)
  • Claude Code version: latest
  • Model: claude-opus-4-6

What Should Happen?

WebSearch returns search results normally.

Error Messages/Logs

Every WebSearch call returns:
  API Error: 400 Input is too long for requested model

Steps to Reproduce

  1. Start a new Claude Code session with model set to claude-opus-4-6
  2. Ask Claude to perform any web search
  3. The WebSearch tool is called and immediately returns the error

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.104

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

## Additional Context

  • The error occurs on every query, including very short ones (e.g. "hello")
  • Setting "model": "claude-opus-4-6[1m]" in settings.json (1M context window) does not fix the issue
  • The problem appears to be that WebSearch uses a separate internal small model to process results, which is not affected by the user's model setting
  • WebFetch (with a direct URL) works fine as a workaround

## Possible Root Cause

WebSearch seems to process results through a small internal model with a limited context window. The search results exceed that model's limit, causing the 400 error.
This internal model is not configurable by the user.

View original on GitHub ↗

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