OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: RuntimeError

Open xhatz opened this issue 7 months ago • 0 comments

Is there an existing issue for the same bug? (If one exists, thumbs up or comment on the issue instead).

  • [x] I have checked the existing issues.

Describe the bug and reproduction steps

I am getting this error when trying to use devstral-small:free from openrouter:

RuntimeError: There was an unexpected error while running the agent: ValidationError. You can refresh the page or ask the agent to try again. RuntimeError: There was an unexpected error while running the agent: ValidationError. You can refresh the page or ask the agent to try again.

OpenHands Installation

Docker command in README

OpenHands Version

0.39.0

Operating System

WSL on Windows

Logs, Errors, Screenshots, and Additional Context

[Agent Controller b2490adf20fe4d47ad1924984b9049b8] Error while running the agent (session ID: b2490adf20fe4d47ad1924984b9049b8): 1 validation error for TokenUsage context_window Input should be a valid integer [type=int_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.11/v/int_type. Traceback: Traceback (most recent call last): File "/app/openhands/controller/agent_controller.py", line 305, in _step_with_exception_handling await self._step() File "/app/openhands/controller/agent_controller.py", line 827, in _step action = self.agent.step(self.state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/openhands/agenthub/codeact_agent/codeact_agent.py", line 211, in step response = self.llm.completion(**params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 338, in wrapped_f return copy(f, *args, **kw) ^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 477, in call do = self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 378, in iter result = action(retry_state) ^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 400, in self._add_action_func(lambda rs: rs.outcome.result()) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 480, in call result = fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/app/openhands/llm/llm.py", line 337, in wrapper cost = self._post_completion(resp) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/openhands/llm/llm.py", line 619, in _post_completion self.metrics.add_token_usage( File "/app/openhands/llm/metrics.py", line 147, in add_token_usage usage = TokenUsage( ^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/pydantic/main.py", line 253, in init validated_self = self.pydantic_validator.validate_python(data, self_instance=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pydantic_core._pydantic_core.ValidationError: 1 validation error for TokenUsage context_window Input should be a valid integer [type=int_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.11/v/int_type

xhatz avatar May 22 '25 04:05 xhatz