beta_tool validation errors reach the model as "Invalid arguments for function X" with no detail
Los mantenedores suelen responder en 2 días
@mangeshraut712 ya está trabajando en esto.
Desde el 27/10/2026.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- developer-experience
Línea de trabajo
Comienza en src/anthropic/lib/tools/_beta_functions.py: BetaFunctionTool.call y BetaAsyncFunctionTool.call lanzan ValueError("Invalid arguments for function <name>") desde un pydantic.ValidationError; incluye un breve resumen de los errores de campo en ese mensaje tanto para la ruta síncrona como para la asíncrona. Reprodúcelo con el fragmento del issue y luego actualiza la cadena esperada exacta en tests/lib/tools/test_runners.py alrededor de la línea 2009. Listo cuando el resultado de la herramienta nombre el argumento fallido y el motivo y las pruebas pasen. Ten en cuenta que el reportante pidió trabajar en ello, así que consulta en el hilo antes de empezar.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 4k
- Forks
- 905
- Merge medio
- 5 min
- PR fusionados (30 d)
- 1
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de anthropics/anthropic-sdk-python
-
`AnthropicBedrock` 2.x sends `anthropic_version: 2026-10-21`, which Bedrock rejects for Claude Sonnet 4.5, Opus 4.5 and Opus 4.6Posiblemente ocupada @charan-rathore la tomó hace 13 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
anthropics/anthropic-sdk-python#2031 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 61/100
anthropics/anthropic-sdk-python#2029 ·
Los mantenedores suelen responder en 2 días
-
Fix test collection and execution errors on Windows (geteuid, FileStore skip, bedrock tempfile lock)Posiblemente ocupada @prasad2512 la tomó hace 17 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
anthropics/anthropic-sdk-python#2027 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
-
Three symlink tests in test_agent_toolset.py are missing the needs_symlinks markerPosiblemente ocupada @okxint la tomó hace 59 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
anthropics/anthropic-sdk-python#1915 · 3 comentarios ·
Los mantenedores suelen responder en 2 días
-
Messages.parse (and AsyncMessages.parse) don't take cache_control?Posiblemente ocupada @Alphaxiaoteng la tomó hace 63 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
anthropics/anthropic-sdk-python#1907 ·
Los mantenedores suelen responder en 2 días
Todos los issues de anthropics/anthropic-sdk-python
Issues similares
-
fuzz fuzz-unconfirmed
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
neilsh/stunt-reel#220 ·
Los mantenedores suelen responder en 1 día
-
[Issue]: use_fp4_cache is accepted but ignored; the launcher always writes FP8 recordsPosiblemente ocupada @0z5a la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
area: cli priority: p3 size: S type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
finos/open-resource-broker#757 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 6 días