Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Handle BadRequests in agent controller (#5991)

Robert Brennan23df4a09d230
diff --git a/openhands/controller/agent_controller.py b/openhands/controller/agent_controller.py
index e76439f794..2b6c116fef 100644
--- a/openhands/controller/agent_controller.py
+++ b/openhands/controller/agent_controller.py
@@ -206,7 +206,9 @@ class AgentController:
reported = RuntimeError(
'There was an unexpected error while running the agent.'
)
- if isinstance(e, litellm.AuthenticationError):
+ if isinstance(e, litellm.AuthenticationError) or isinstance(
+ e, litellm.BadRequestError
+ ):
reported = e
await self._react_to_exception(reported)