Invalid pages parameter: "" Claude Code
Quick fix
将 API 格式切换为 anthropic,或升级 cc-switch 以修复 Responses 转换产生的空 pages 字段问题。
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>当在 cc-switch 中使用 OpenAI Responses API 或 chat completions 接口格式(如接入 NVIDIA、Deepseek、百炼等模型)时,Responses 转换为 Anthropic 格式的过程中,Read 工具的参数会错误地携带空字符串形式的 `pages: ""` 字段。
`pages` 参数仅对 PDF 读取有意义。对于普通文件读取,Claude Code 接收到空 `pages` 字段时会触发校验并抛出 `Invalid pages parameter` 错误。若直接使用 `anthropic` 接口格式则不会经过此转换逻辑,因此可正常调用工具。
在 cc-switch 的配置中,将当前模型的 API 格式从 "OpenAI Responses API" 或 "chat completions" 修改为 "anthropic"。
升级 cc-switch 至包含此修复的最新版本,或拉取合并了 #2471 PR 的源码重新编译程序。
Affected Versions
Section titled “Affected Versions”ToolClaude Code
Version3.14.1 - 3.15.0
PlatformsWindows
Source Issues
Section titled “Source Issues”本页汇总自 2 个真实 issue
- 为什么单纯对话没问题,一调用工具就报错?
- 单纯对话不涉及工具调用。只有当 AI 尝试使用 Read 工具读取文件时,cc-switch 的格式转换才会生成包含 `pages: ""` 的非法参数,进而触发 Claude Code 报错。
- 这个问题只影响特定模型吗?
- 不是模型的问题,而是接口格式的问题。只要使用 `chat completions` 或 Responses API 格式(如 NVIDIA、Deepseek、百炼),都会遇到此问题。切换为 `anthropic` 格式即可解决。
api failed deserialize json body into按错误类型回退 Claude Code、升级 cc-switch、关闭本地代理或停止发送不支持的字段。This model is not supported when using注释掉 config.yaml 中的 model_provider = custom,恢复使用官方 OpenAI provider。Console Go: Upstream request failed该 400 错误由 OpenCode Go 网关拒绝不兼容的请求负载引起。可通过重启代理恢复会话映射,或避免使用 WebSearch 和图片功能等待后续修复。
这是一个非官方社区 wiki,与 cc-switch 作者及项目本身无隶属关系。内容整理自项目公开的 GitHub issues。本站不分发任何软件。