Skip to content

[Bug]: RuntimeError #8629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
xhatz opened this issue May 22, 2025 · 0 comments
Open
1 task done

[Bug]: RuntimeError #8629

xhatz opened this issue May 22, 2025 · 0 comments
Labels
bug Something isn't working troubleshooting/help User requires help

Comments

@xhatz
Copy link

xhatz commented May 22, 2025

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

  • 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 xhatz added the bug Something isn't working label May 22, 2025
@mamoodi mamoodi added the troubleshooting/help User requires help label May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working troubleshooting/help User requires help
Projects
None yet
Development

No branches or pull requests

2 participants