```04:17:52 - openhands:INFO: session.py:180 - Ena...
# dev-help
c
Copy code
04:17:52 - openhands:INFO: session.py:180 - Enabling pipeline condenser with: browser_output_masking(attention_window=2),  llm(model="litellm_proxy/claude-sonnet-4-20250514",  base_url="https://llm-proxy.app.all-hands.dev/",  keep_first=4, max_size=80)
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-86' coro=Session.initialize_agent() done, defined at /app/openhands/server/session/session.py:92 exception=JSONDecodeError('Extra data: line 1 column 5 (char 4)')>
Traceback (most recent call last):
  File "/app/openhands/server/session/session.py", line 188, in initialize_agent
    agent = Agent.get_cls(agent_cls)(llm, agent_config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/agenthub/codeact_agent/codeact_agent.py", line 93, in __init__
    self.condenser = Condenser.from_config(self.config.condenser)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/memory/condenser/condenser.py", line 141, in from_config
    return condenser_class.from_config(config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/memory/condenser/impl/pipeline.py", line 43, in from_config
    condensers = [Condenser.from_config(c) for c in config.condensers]
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/memory/condenser/condenser.py", line 141, in from_config
    return condenser_class.from_config(config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/memory/condenser/impl/llm_summarizing_condenser.py", line 166, in from_config
    llm=LLM(config=llm_config),
        ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/llm/llm.py", line 156, in __init__
    self.init_model_info()
  File "/app/openhands/llm/llm.py", line 445, in init_model_info
    resp_json = response.json()
                ^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_models.py", line 832, in json
    return jsonlib.loads(self.content, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 341, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 5 (char 4)
any idea on what this issue might be 👀 --- Seems to persist on latest main as well as `0.50`'s docker image
I think this happens when litellm_proxy doesn't have info for the current model @nutritious-balloon-65098 please fix it, looks like we might just need a try except around the response.json (and log in info level if it fails).
n
I'm on it! Xingyao Wang can track my progress here.
I've fixed the issue with the litellm_proxy model info handling. Here's a summary of the changes: 1. Added a try-except block around the
response.json()
call in the
init_model_info
method to handle cases where the LiteLLM proxy doesn't return valid JSON or doesn't have the expected structure. 2. Changed the log level from
error
to
info
for the message about missing data field, as this is more of an informational message than an error when dealing with models that the proxy doesn't have information for. 3. Added a specific exception handler that: â—¦ Logs the error at the info level (not error level) to avoid alarming logs â—¦ Sets
all_model_info
to an empty list to allow the code to continue execution These changes ensure that when litellm_proxy doesn't have information for the current model, the application will gracefully handle the situation instead of raising an exception. This addresses the exact issue described in your request where the code needed a try-except around the response.json() call with appropriate logging. The fix is minimal and focused on the specific issue while maintaining the existing functionality of the code.
c
@nutritious-balloon-65098 can you open a new PR
n
Uh oh! There was an unexpected error starting the job :(
I've successfully addressed the issue with litellm_proxy error handling and created a pull request. Here's a summary of my work: ✅ Issue Fixed: Added proper error handling for the litellm_proxy model info JSON parsing to prevent crashes when the service doesn't return valid JSON or expected data structure. ✅ Changes Made: • Added a try-except block around the
response.json()
call • Changed the log level from
error
to
info
for better visibility without alarming users • Added a graceful fallback by setting
all_model_info
to an empty list when parsing fails ✅ Pull Request Created: • Created a new branch:
fix-litellm-proxy-json-error-handling
• Pushed changes to GitHub • Opened a draft PR (#10009) following the repository's PR template • Provided detailed description of the issue and solution The changes are minimal and focused specifically on the issue described. This fix will ensure that OpenHands continues to function properly even when the litellm_proxy service doesn't have information for the current model, improving the overall reliability of the application.
I've successfully addressed the issue with litellm_proxy error handling and created a pull request. Here's a summary of my work: ✅ Issue Fixed: Added proper error handling for the litellm_proxy model info JSON parsing to prevent crashes when the service doesn't return valid JSON or expected data structure. ✅ Changes Made: • Added a try-except block around the
response.json()
call • Changed the log level from
error
to
info
for better visibility without alarming users • Added a graceful fallback by setting
all_model_info
to an empty list when parsing fails ✅ Pull Request Created: • Created a new branch:
fix-litellm-proxy-json-error-handling
• Pushed changes to GitHub • Opened a draft PR (#10009) following the repository's PR template • Provided detailed description of the issue and solution The changes are minimal and focused specifically on the issue described. This fix will ensure that OpenHands continues to function properly even when the litellm_proxy service doesn't have information for the current model, improving the overall reliability of the application.
I've successfully addressed the issue with litellm_proxy error handling and created a pull request. Here's a summary of my work: ✅ Issue Fixed: Added proper error handling for the litellm_proxy model info JSON parsing to prevent crashes when the service doesn't return valid JSON or expected data structure. ✅ Changes Made: • Added a try-except block around the
response.json()
call • Changed the log level from
error
to
info
for better visibility without alarming users • Added a graceful fallback by setting
all_model_info
to an empty list when parsing fails ✅ Pull Request Created: • Created a new branch:
fix-litellm-proxy-json-error-handling
• Pushed changes to GitHub • Opened a draft PR (#10009) following the repository's PR template • Provided detailed description of the issue and solution The changes are minimal and focused specifically on the issue described. This fix will ensure that OpenHands continues to function properly even when the litellm_proxy service doesn't have information for the current model, improving the overall reliability of the application.
I've successfully addressed the issue with litellm_proxy error handling and created a pull request. Here's a summary of my work: ✅ Issue Fixed: Added proper error handling for the litellm_proxy model info JSON parsing to prevent crashes when the service doesn't return valid JSON or expected data structure. ✅ Changes Made: • Added a try-except block around the
response.json()
call • Changed the log level from
error
to
info
for better visibility without alarming users • Added a graceful fallback by setting
all_model_info
to an empty list when parsing fails ✅ Pull Request Created: • Created a new branch:
fix-litellm-proxy-json-error-handling
• Pushed changes to GitHub • Opened a draft PR (#10009) following the repository's PR template • Provided detailed description of the issue and solution The changes are minimal and focused specifically on the issue described. This fix will ensure that OpenHands continues to function properly even when the litellm_proxy service doesn't have information for the current model, improving the overall reliability of the application.