beta_tool validation errors reach the model as "Invalid arguments for function X" with no detail
メンテナーはふだん 1 日以内に返信
@mangeshraut712 がすでに取り組んでいます。
2026年10月27日 から。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
src/anthropic/lib/tools/_beta_functions.py から始めてください。BetaFunctionTool.call と BetaAsyncFunctionTool.call は pydantic.ValidationError から ValueError("Invalid arguments for function <name>") を送出します。sync と async の両方のパスで、そのメッセージにフィールドエラーの短い要約を含めてください。issue のスニペットで再現し、その後 tests/lib/tools/test_runners.py の 2009 行目あたりで期待される正確な文字列を更新してください。ツールの結果が失敗した引数と理由を示し、テストが通れば完了です。報告者が作業を希望しているため、始める前にスレッドで確認してください。
索引モデルが issue の本文から書いたものです。
説明
When the model calls a beta_tool function with arguments that fail validation, the tool result it gets back doesn't say what was wrong.
In src/anthropic/lib/tools/_beta_functions.py, BetaFunctionTool.call and BetaAsyncFunctionTool.call catch pydantic.ValidationError and raise ValueError("Invalid arguments for function ") from it. The tool runner then sends repr(exc) back as the tool result, so the model only sees the generic message and the field errors stay on cause. Since it doesn't know which argument was wrong, it can't really fix its next call and tends to retry the same thing.
There's a related smaller problem too. validate_call wraps the whole function, so a ValidationError raised inside the tool body (like building a pydantic model from bad data) gets the same "Invalid arguments" message, which makes a real bug in the tool look like the model's mistake.
Repro (Python 3.11, main at 202db72)
from anthropic import beta_tool
from anthropic.lib.tools._tool_dispatch import tool_error_content
@beta_tool
def set_temp(city: str, celsius: int) -> str:
"""Set temperature."""
return f"{city} {celsius}"
try:
set_temp.call({"city": "Paris", "celsius": "hot"})
except Exception as e:
print(tool_error_content(e))
Output:
ValueError('Invalid arguments for function set_temp')
Expected
The message should name the argument and the reason, something like "Invalid arguments for function set_temp: celsius: Input should be a valid integer".
Fix idea
Add a short summary of the pydantic errors to the ValueError message in both the sync and async tools. The existing tests match on the message prefix, and the exact string in tests/lib/tools/test_runners.py around line 2009 would need updating.
If this sounds right, I would like to work on this.
- 主要言語
- Python
- スター
- 4k
- フォーク
- 905
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
anthropics/anthropic-sdk-python のほかの issue
-
`AnthropicBedrock` 2.x sends `anthropic_version: 2026-10-21`, which Bedrock rejects for Claude Sonnet 4.5, Opus 4.5 and Opus 4.6対応中かも @charan-rathore が 15 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
anthropics/anthropic-sdk-python#2031 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 61/100
anthropics/anthropic-sdk-python#2029 ·
メンテナーはふだん 1 日以内に返信
-
Fix test collection and execution errors on Windows (geteuid, FileStore skip, bedrock tempfile lock)対応中かも @prasad2512 が 18 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
anthropics/anthropic-sdk-python#2027 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Three symlink tests in test_agent_toolset.py are missing the needs_symlinks marker対応中かも @okxint が 61 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
anthropics/anthropic-sdk-python#1915 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Messages.parse (and AsyncMessages.parse) don't take cache_control?対応中かも @Alphaxiaoteng が 65 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
anthropics/anthropic-sdk-python#1907 ·
メンテナーはふだん 1 日以内に返信
anthropics/anthropic-sdk-python の issue をすべて見る
似ている issue
-
binding:python bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
The Browser tab fails with a Wayland error when Open Terminal runs from a Wayland desktop sessionオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
open-webui/open-terminal#210 ·
-
triage/confirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
agentscope-ai/agentscope#3807 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NousResearch/hermes-agent#150542 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
triton-inference-server/server#9069 ·
メンテナーはふだん 1 日以内に返信