【Claude】thinking / budget_tokens / tool use concurrency / Usage Policy 报错已解决(4合1)
【Claude】thinking / budget_tokens / tool use concurrency / Usage Policy 报错已解决(4合1)
关键词:Claude Code、thinking.type.enabled、max_tokens、budget_tokens、tool use concurrency、/rewind、Usage Policy、使用政策拒绝
报错一:thinking.type.enabled is not supported for this model
现象
API Error: 400 ... "thinking.type.enabled" is not supported for this model. Use "thinking.type.adaptive" and "output_config.effort" to control thinking behavior.
根因:Claude Code 版本过旧
这个错误不是你的配置问题,而是你的 Claude Code 版本太旧了。Anthropic 在 Opus 4.7 / 4.8 发布时更新了扩展思考(Extended Thinking)的 API 接口:旧版用 thinking.type.enabled,新版改为 thinking.type.adaptive + output_config.effort。
旧版 CLI 还在发送旧格式,模型已经不接受了,所以报这个错。
版本对应关系:
| 模型 | 最低 CLI 版本 |
|---|---|
| Opus 4.7 | v2.1.111 |
| Opus 4.8 | v2.1.154 |
解法
claude update
更新后重启。
如果无法更新(受限环境),临时改用旧版 Opus(4.6)或 Sonnet:
/model
选择 Opus 4.6 或 claude-sonnet。
报错二:max_tokens must be greater than thinking.budget_tokens
现象
API Error: 400 ... max_tokens must be greater than thinking.budget_tokens
根因:扩展思考预算超过了最大输出长度
Claude 的扩展思考(Extended Thinking)机制:模型先在"思考空间"里推理(消耗 thinking budget),然后再输出最终答案(消耗 max_tokens)。
规则很简单:max_tokens(最大输出 Token 数)必须大于 thinking.budget_tokens(思考预算)——因为思考部分是输出的子集,总输出容量必须能同时容纳思考内容和实际答案。
Claude Code 在 Anthropic 官方 API 上会自动处理这两个值的关系,保持一致。但在以下情况会报错:
- Amazon Bedrock:Bedrock 有自己的输出 Token 上限,比官方 API 更低;
- Google Vertex AI:同上;
MAX_THINKING_TOKENS设置得过高:超过了对应提供商的输出上限;- Plan 模式提高了思考预算:某些情况下 plan 模式会自动拉高 budget,可能超过提供商上限。
解法
方法一:降低 MAX_THINKING_TOKENS
export MAX_THINKING_TOKENS=10000 # 按需调整到低于提供商输出上限

方法二:提高 CLAUDE_CODE_MAX_OUTPUT_TOKENS
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=32000 # 必须大于 budget_tokens
基本原则:确保 CLAUDE_CODE_MAX_OUTPUT_TOKENS > MAX_THINKING_TOKENS。
报错三:API Error: 400 due to tool use concurrency issues
现象
API Error: 400 due to tool use concurrency issues. Run /rewind to recover the conversation.
API Error: 400 ... unexpected `tool_use_id` found in `tool_result` blocks
API Error: 400 ... thinking blocks ... cannot be modified
根因:对话历史中 tool_use / tool_result / thinking 块的顺序/配对不一致
这三种 400 错误本质相同:对话历史记录的结构损坏了。
Claude API 要求工具调用(tool_use)和工具结果(tool_result)严格配对,且思考块(thinking)不能被修改。当出现以下情况时,对话历史就会进入不一致状态:
- 工具调用被用户中断(Ctrl+C);
- 对话在流式传输中途被编辑;
- 某些旧版本 CLI 在正常工具使用期间的 Bug。
解法
第一步:升级 CLI(如果用 Opus 4.7 / 4.8 触发)
claude update
v2.1.156 之前的版本在 Opus 4.7/4.8 的正常工具使用期间可能触发此错误,且 /rewind 无法清除。升级到 v2.1.156+ 才能根治。
第二步:运行 /rewind 恢复对话
/rewind
或者按两次 Esc,回退到损坏的那一轮之前的检查点,从那里继续。
如果 /rewind 也无法修复(仍是旧版本 Bug):
/clear
报错四:Claude Code is unable to respond to this request, which appears to violate our Usage Policy
现象
API Error: Claude Code is unable to respond to this request, which appears to violate our Usage Policy (https://www.anthropic.com/legal/aup). Please double press esc to edit your last message or start a new session for Claude Code to assist with a different task.
根因:API 判断对话内容违反使用政策
API 评估的是整个对话上下文,不只是你的最新消息。这意味着:
- 即使你的新消息没问题,对话历史里某处触发了检查,后续消息也会持续触发;
- 用
--continue或--resume退出后重新打开同一会话,也一样会触发(因为历史记录还在磁盘上)。
注意:消息里包含一个请求 ID。如果你认为拒绝不正确,可以用这个 ID 联系 Anthropic 支持。
解法
方案一:回退到触发前
/rewind
或双按 Esc,找到触发拒绝的那一轮消息并回退到它之前,然后换一种方式重新表述。
方案二:开新对话(推荐,如果找不到触发轮)
/clear
旧对话保存在磁盘上,可以 /resume 查看,但不要用 --continue 继续那个会话(历史记录还在)。
方案三:非交互模式(-p)下
/rewind 不可用,用重新表述的 prompt 重试,或开启新会话(不加 --continue)。
总结
| 报错 | 根因 | 核心解法 |
|---|---|---|
| thinking.type.enabled | CLI 版本过旧 | claude update |
| max_tokens < budget_tokens | 思考预算超提供商输出上限 | 降 MAX_THINKING_TOKENS 或升 MAX_OUTPUT_TOKENS |
| tool use concurrency 400 | 对话历史工具块结构损坏 | 升级 CLI + /rewind 或 /clear |
| Usage Policy refusal | 对话内容触发使用政策检查 | /rewind 回退改写,或 /clear 开新会话 |
参考:Claude Code 官方《错误参考》"请求错误"章节、扩展思考文档、检查点文档。
更多推荐




所有评论(0)