Skip to content

InputValidationError: Write failed - Claude Code

Quick fix

Turn Tool Search, maximum-effort thinking, and the 1M context declaration off in cc-switch to reduce long-text truncation, or roll back to 3.13.0.

Error output
InputValidationError: Write failed due to the following issues:
  The required parameter `file_path` is missing
  The required parameter `content` is missing

When cc-switch routes Claude Code to an OpenAI Chat Completions-compatible endpoint such as Copilot, the parameters of a long-text tool call (Write, Edit) stream back across several SSE frames. In `streaming_codex_chat.rs`, if a chunk's JSON is briefly invalid because of TCP fragmentation, the parse failure triggers a `continue` and the chunk is silently dropped. `json_canonical.rs` then passes the incomplete JSON on as-is, so the client receives an empty object missing required parameters and errors.

  1. Roll cc-switch back to 3.13.0, which does not include the streaming parse optimisation causing this and resolves it fully.

  2. To stay on the current version, untick "enable Tool Search", "maximum-effort thinking", and "declare 1M support" in the model mapping in the cc-switch UI.

    环境变量等效配置
    ENABLE_TOOL_SEARCH=0
    CLAUDE_CODE_EFFORT_LEVEL=default
  3. Quit and restart cc-switch and Claude Code completely. If medium-to-long text still fails occasionally, retry the command by hand.

ToolClaude Code
Version3.14.1 - 3.16.1
PlatformsWindowsmacOS
Why do tools like Read work while only Write and Edit fail intermittently?
Write and Edit parameters are usually longer, making TCP fragmentation more likely to break SSE frame JSON parsing and get the chunk silently truncated.
Why does retrying the same command sometimes succeed?
A timing dependency: a retry produces new TCP timing and frame boundaries, which may happen to avoid the JSON truncation.
Does setting defaultMode: acceptEdits in settings.json resolve it?
No. The problem is in the cc-switch proxy conversion logic underneath and has nothing to do with Claude Code permission settings.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.