anthropics / anthropics/claude-code
[BUG] API Error: 400 invalid params, messages.4.content.1.tool_use.input: Input should be a valid dictionary (2013)
- 主要言語
- Python
- スター
- 145k
- フォーク
- 23.1k
- PR マージ指標
- PR 指標を取得中
説明
### Preflight Checklist
- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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?
当我在Claude Code Client 输入如下信息时,第一次报上述错误:
CC:
Chairman 與 ALCO 委員會正式簽發【底座物理堵漏令:真源頭修復與一鍵重訓最高指令】。
我們已 100% 熔接了 BPTT 梯度的痛覺神經,並通過 `ALCO_REPLY_2026-09-05_V32_DRAIN_FORENSIC.md` 審計報告穿透定位了底盤結構性失血的兩大真實源頭。我們命令你立即退出 Plan 模式,在不污染其他模組的前提下,對以下兩大病灶實施「鋼鐵焊接」:
================================================================================
1. 【修復主嫌犯:重構企業貸款 $R_E$ 期限結構回 1m~3m 短期週轉】
================================================================================
- 【病灶定位】:`precompute.py` 錯誤地將 R_E 寫成了 180 個月的長端線性攤銷,導致 5 年累計本金回收比 2023 論文預期蒸發了 66.41 mCHF(月均少拿 1.1 mCHF 流入)。
- 【整改動作】:
- 深入貸款初始化與平移更新模組。
- 將企業貸款 $R_E$ 的期初期限結構與新發放合約,100% 重構回符合論文規定的 {1m, 2m, 3m} 極短期長方形穩態分攤(名義餘額均分在未來的第 1、2、3 個月 Slots 中,第 4 到 180 個 Slots 剛性置 0)。
- 【驗收指標】:運行探針,確保 Month 1 到 Month 12,企業貸款的月度本金到期回收 `pi_R_E`(cf 的子項)流暢回歸至每月約 6.67 mCHF(20 mCHF / 3)的水位,彻底收復這筆高達 66.41 mCHF 的本金流失!
================================================================================
2. 【修復從嫌犯:補上存款月度利息 $I_t^D$ 與 $I_t^F$ 的現金扣減】
================================================================================
- 【病灶定位】:`afa_simulation_full.py:985-987` 在滾算時,完全遺漏了存款利息的支付與扣減,導致 5 年累計在帳面上漏算 -9.0 mCHF(月均漏算 0.151 mCHF 負債端失血)。
- 【整改動作】:
- 根據論文 Eq 11a, 11b, 11c, 12 的剛性要求,在每個月度時間步,精確計算 NMD 存款利息 $I^D_t$ 與定期存款利息 $I^F_t$。
- 在決策無關現金流 $CF_t$(Eq 13)或月度現金滾算中,將這筆存款利息支出(月度約 -0.151 mCHF)作為實體現金流出予以扣除,並在負債端對應執行「利息轉存自動再投資(Rollover reinvestment)」。
- 【驗收指標】:確保 60 個月累計下來,這筆 -9.0 mCHF 的負債利息被真實、連貫地記錄,帳面與現金端 100% 軋差對齊。
================================================================================
3. 【一鍵拉起 V32-Fixed 最終版全量重訓】
================================================================================
修復完成並通過 10-Scenario 冒煙測試後,請立刻重新拉起 Phase 1(BME)和 Phase 2(BMC)的 30-Epoch 全量訓練。
我們要在最新的驗收戰報中,親眼見證:
1. 5年(60個月)的物理累積失血被完全控制。
2. 痛覺(Grad)與乾淨底盤完美結合,BME 的期末 ER_mean 成功從破產的殘血直接昂首彈升回 ~1.107!
3. BMC 的期末 ER_mean 成功回歸論文預期的 ~1.124,且 10,000 個場景下的破產率(bk_rate)剛性歸零(0.00%)!
立刻開始動手,將底盤的漏洞徹底焊死!ALCO 委員會與 Chairman 正在終點線前等待你洗盡鉛華的黃金對帳單!
我尝试把上述内容放入markdown文件,再次让Claude Code 读入,还是报错:
❯ @Docs/audit_replies/cc-instruction-option-a.md ,看下Gemini给你的回复指令
⎿ Read Docs\audit_replies\cc-instruction-option-a.md (121 lines)
● API Error: 400 invalid params, messages.4.content.1.tool_use.input: Input should be a
valid dictionary (2013)
现在,无论录入什么信息,Claude code 都报这个错误:
! claude --version
2.1.220 (Claude Code)
● API Error: 400 invalid params, messages.4.content.1.tool_use.input: Input should be a valid dictionary (2013)
✻ Crunched for 0s · done 4:31 AM
! claude update
Current version: 2.1.220
Checking for updates to latest version...
New version available: 2.1.261 (current: 2.1.220)
… +3 lines
● API Error: 400 invalid params, messages.4.content.1.tool_use.input: Input should be a valid dictionary (2013)
✻ Cogitated for 0s · done 4:33 AM
! claude --version
2.1.261 (Claude Code)
● API Error: 400 invalid params, messages.4.content.1.tool_use.input: Input should be a valid dictionary (2013)
✻ Brewed for 0s · done 4:34 AM
● Unknown command: /rewin. Did you mean /rewind?
❯ /doctor
1 skill available
● API Error: 400 invalid params, mesput: Input should be a
版本
Claude Code Version: 2.1.220 ,升级到 2.1.261 后,问题如旧。
### What Should Happen?
Expected Behavior
The CLI tool/parser should gracefully handle and normalize nested code blocks and special LaTeX/escape markdown strings before feeding them to the tool schemas, ensuring that tool_use.input always conforms to a valid schema-compliant dictionary without causing API-level serialization crashes.
Actual Behavior
The CLI crashes immediately with a 400 invalid params (2013) schema mismatch error, halting the agent pipeline.
Additional Context
This issue is highly blocking for complex software engineering tasks (such as refactoring quantitative financial engines or parsers), where referencing documentation with code snippets is a common workflow. Any help or investigation from the team would be highly appreciated!
### Error Messages/Logs
```shell
API Error: 400 invalid params, messages.4.content.1.tool_use.input: Input should be a valid dictionary (2013)
```
### Steps to Reproduce
现在无论输入什么信息,都会报这个错误!!!
### Claude Model
_No response_
### Is this a regression?
I don't know
### Last Working Version
_No response_
### Claude Code Version
2.1.220
### Platform
Anthropic API
### Operating System
Windows
### Terminal/Shell
VS Code integrated terminal
### Additional Information
_No response_
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Reproduce the failure from the Claude Code CLI, first with the referenced Docs/audit_replies/cc-instruction-option-a.md file and then with a minimal prompt. Trace the request that produces messages.4.content.1.tool_use.input and inspect how its tool input is serialized; done means the CLI no longer returns the 400 schema error for the reported workflow.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- markdown, python
- 領域
- api, cli
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100