Fix tool call validation error handling for Groq LLM provider (#10927)

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
Engel Nyst
2025-12-19 07:31:07 +01:00
committed by GitHub
parent 88c053b23c
commit ec9daf3bcc
2 changed files with 66 additions and 0 deletions

View File

@@ -944,6 +944,23 @@ class AgentController:
return
else:
raise LLMContextWindowExceedError()
# Check if this is a tool call validation error that should be recoverable
elif (
isinstance(e, BadRequestError)
and 'tool call validation failed' in error_str
and (
'missing properties' in error_str
or 'missing required' in error_str
)
):
# Handle tool call validation errors from Groq as recoverable errors
self.event_stream.add_event(
ErrorObservation(
content=f'Tool call validation failed: {str(e)}. Please check the tool parameters and try again.',
),
EventSource.AGENT,
)
return
else:
raise e