Skip to content

[Bug]: App errors if base URL contains whitespace #7760

Closed
@amanape

Description

@amanape

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

We should trim the data of whitespace before sending it to the server

OpenHands Installation

Docker command in README

OpenHands Version

0.31

Operating System

MacOS

Logs, Errors, Screenshots, and Additional Context

18:46:27 - openhands:INFO: standalone_conversation_manager.py:319 - found_local_agent_loop:817f5dc59b8e4aeb84cd167d96f7be0d
18:46:27 - openhands:INFO: manage_conversations.py:142 - Finished initializing conversation 817f5dc59b8e4aeb84cd167d96f7be0d
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-38' coro=<Session.initialize_agent() done, defined at /Users/../Desktop/All Hands AI/OpenHands/openhands/server/session/session.py:83> exception=UnsupportedProtocol("Request URL is missing an 'http://' or 'https://' protocol.")>
Traceback (most recent call last):
  File "/Users/../Library/Caches/pypoetry/virtualenvs/openhands-ai-q6lpIkNh-py3.12/lib/python3.12/site-packages/httpx/_transports/default.py", line 101, in map_httpcore_exceptions
    yield
  File "/Users/../Library/Caches/pypoetry/virtualenvs/openhands-ai-q6lpIkNh-py3.12/lib/python3.12/site-packages/httpx/_transports/default.py", line 250, in handle_request
    resp = self._pool.handle_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/../Library/Caches/pypoetry/virtualenvs/openhands-ai-q6lpIkNh-py3.12/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py", line 207, in handle_request
    raise UnsupportedProtocol(
httpcore.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/../Desktop/All Hands AI/OpenHands/openhands/server/session/session.py", line 124, in initialize_agent
    llm = self._create_llm(agent_cls)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/../Desktop/All Hands AI/OpenHands/openhands/server/session/session.py", line 170, in _create_llm
    return LLM(
           ^^^^
  File "/Users/../Desktop/All Hands AI/OpenHands/openhands/llm/llm.py", line 131, in __init__
    self.init_model_info()
  File "/Users/../Desktop/All Hands AI/OpenHands/openhands/llm/llm.py", line 378, in init_model_info
    response = httpx.get(
               ^^^^^^^^^^
  File "/Users/../Library/Caches/pypoetry/virtualenvs/openhands-ai-q6lpIkNh-py3.12/lib/python3.12/site-packages/httpx/_api.py", line 195, in get
    return request(
           ^^^^^^^^
  File "/Users/../Library/Caches/pypoetry/virtualenvs/openhands-ai-q6lpIkNh-py3.12/lib/python3.12/site-packages/httpx/_api.py", line 109, in request
    return client.request(
           ^^^^^^^^^^^^^^^
  File "/Users/../Library/Caches/pypoetry/virtualenvs/openhands-ai-q6lpIkNh-py3.12/lib/python3.12/site-packages/httpx/_client.py", line 825, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/../Library/Caches/pypoetry/virtualenvs/openhands-ai-q6lpIkNh-py3.12/lib/python3.12/site-packages/httpx/_client.py", line 914, in send
    response = self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/../Library/Caches/pypoetry/virtualenvs/openhands-ai-q6lpIkNh-py3.12/lib/python3.12/site-packages/httpx/_client.py", line 942, in _send_handling_auth
    response = self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/../Library/Caches/pypoetry/virtualenvs/openhands-ai-q6lpIkNh-py3.12/lib/python3.12/site-packages/httpx/_client.py", line 979, in _send_handling_redirects
    response = self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/../Library/Caches/pypoetry/virtualenvs/openhands-ai-q6lpIkNh-py3.12/lib/python3.12/site-packages/httpx/_client.py", line 1014, in _send_single_request
    response = transport.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/../Library/Caches/pypoetry/virtualenvs/openhands-ai-q6lpIkNh-py3.12/lib/python3.12/site-packages/httpx/_transports/default.py", line 249, in handle_request
    with map_httpcore_exceptions():
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/../.pyenv/versions/3.12.8/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/../Library/Caches/pypoetry/virtualenvs/openhands-ai-q6lpIkNh-py3.12/lib/python3.12/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions