Content-Length: 344689 | pFad | https://github.com/All-Hands-AI/OpenHands/pull/10009#event-18921374431

1A Fix litellm_proxy model info JSON parsing error handling by xingyaoww · Pull Request #10009 · All-Hands-AI/OpenHands · GitHub
Skip to content

Conversation

xingyaoww
Copy link
Collaborator

@xingyaoww xingyaoww commented Jul 31, 2025

  • This change is worth documenting at https://docs.all-hands.dev/
  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

End-user friendly description of the problem this fixes or functionality this introduces.

Fixed an issue where OpenHands could crash when the litellm_proxy service doesn't return valid JSON or expected data structure for model information. This improves reliability when using models through the OpenHands provider.


Summarize what the PR does, explaining any non-trivial design decisions.

This PR adds proper error handling around the JSON parsing of the litellm_proxy response in the init_model_info method. Previously, if the litellm_proxy service returned an invalid JSON response or didn't include the expected data structure, it would cause an unhandled exception.

The changes:

  1. Added a try-except block around the response.json() call
  2. Changed the log level from error to info for better visibility without alarming users
  3. Provides a graceful fallback by setting all_model_info to an empty list when parsing fails

This ensures that even if the litellm_proxy service doesn't have information for the current model, the application will continue to function properly.


Link of any specific issues this addresses:

https://openhands-ai.slack.com/archives/C078L0FUGUX/p1753935514200279


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:fffb817-nikolaik   --name openhands-app-fffb817   docker.all-hands.dev/all-hands-ai/openhands:fffb817

@xingyaoww xingyaoww marked this pull request as ready for review July 31, 2025 04:54
@xingyaoww xingyaoww enabled auto-merge (squash) July 31, 2025 13:16
@xingyaoww xingyaoww disabled auto-merge July 31, 2025 13:27
@xingyaoww xingyaoww force-pushed the fix-litellm-proxy-json-error-handling branch from 86ad4d6 to 1c10032 Compare July 31, 2025 13:48
@All-Hands-AI All-Hands-AI deleted a comment from openhands-ai bot Jul 31, 2025
@All-Hands-AI All-Hands-AI deleted a comment from openhands-ai bot Jul 31, 2025
Copy link

openhands-ai bot commented Jul 31, 2025

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • Run Python Tests
    • Run Python Tests

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #10009

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

@xingyaoww xingyaoww enabled auto-merge (squash) July 31, 2025 14:31
@xingyaoww xingyaoww merged commit 5282770 into main Jul 31, 2025
17 checks passed
@xingyaoww xingyaoww deleted the fix-litellm-proxy-json-error-handling branch July 31, 2025 14:52
mamoodi pushed a commit that referenced this pull request Jul 31, 2025
Co-authored-by: openhands <openhands@all-hands.dev>
browsergym-core = "0.13.3" # integrate browsergym-core as the browsing interface
html2text = "*"

deprecated = "*"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that you fixed this bug. We have deprecated dependency but we never explicitly declared it. I was debugging why released 0.49.0 pypi version suddenly stopped working (due to missing "deprecated" package), and found out you just fixed it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it might be because we recently cleaned up some dependencies, maybe they were taking it in before. 🤷‍♂️

enyst pushed a commit that referenced this pull request Aug 15, 2025
Co-authored-by: openhands <openhands@all-hands.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/All-Hands-AI/OpenHands/pull/10009#event-18921374431

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy