Invalid pages parameter: "" Claude Code
Quick fix
Switch the API format to anthropic, or upgrade cc-switch to fix the empty pages field from Responses conversion.
Symptom
Section titled “Symptom”<tool_use_error>Invalid pages parameter: "". Use formats like "1-5", "3", or "10-20". Pages are 1-indexed.</tool_use_error>When using OpenAI Responses API or chat completions format in cc-switch (for example with NVIDIA, Deepseek, or Bailian models), the conversion to Anthropic format incorrectly adds an empty `pages: ""` field to Read tool parameters. The `pages` parameter is only meaningful for PDF reading. For normal file reads, Claude Code validates the empty `pages` field and raises the `Invalid pages parameter` error. Using the `anthropic` API format directly bypasses this conversion logic, so tool calls work normally.
In the cc-switch configuration, change the current model's API format from "OpenAI Responses API" or "chat completions" to "anthropic".
Upgrade cc-switch to the latest version containing this fix, or rebuild from source that includes merged PR #2471.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 2 real issues
- Why does normal chat work, but tool calls fail?
- Normal chat does not involve tool calls. Only when the AI tries to use the Read tool to read a file does cc-switch format conversion generate invalid parameters containing `pages: ""`, causing Claude Code to raise the error.
- Does this issue affect only specific models?
- It is not a model-specific issue; it is an API format issue. Any model using `chat completions` or Responses API format, such as NVIDIA, Deepseek, or Bailian, can hit this issue. Switching to `anthropic` format resolves it.
Related problems
Section titled “Related problems”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.