Skip to content

[Bug]: openhands login fails with json decode error #705

@neubig

Description

@neubig

Is there an existing issue for the same bug?

  • I have searched existing issues and this is not a duplicate.

Bug Description

When using "openhands login" I got the following error message

$ openhands login
/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands/sdk/llm/auth/openai.py:24: AuthlibDeprecationWarning: authlib.jose module is deprecated, please use joserfc instead.
It will be compatible before version 2.0.0.
  from authlib.jose import JsonWebKey, jwt
+----------------------------------------------------------------------+
|  OpenHands SDK v1.17.0                                               |
|                                                                      |
|  Report a bug: github.com/OpenHands/software-agent-sdk/issues        |
|  Get help: openhands.dev/joinslack                                   |
|  Scale up: openhands.dev/product/sdk                                 |
|                                                                      |
|  Set OPENHANDS_SUPPRESS_BANNER=1 to hide this message                |
+----------------------------------------------------------------------+

Logging in to OpenHands Cloud...
Starting OpenHands authentication...

Opening your web browser for authentication...
URL: https://app.all-hands.dev/oauth/device/verify?user_code=3MXF3J67
✓ Browser opened successfully
Follow the instructions in your browser to complete authentication

Waiting for authentication to complete...
✓ Authentication successful!
✓ Logged into OpenHands Cloud
Your authentication tokens have been stored securely.
Fetching user data...
• Getting LLM API key...
  ✓ LLM API key retrieved: sk-...
• Getting user settings...
Error: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/entrypoint.py", line 163, in main
    success = run_login_command(args.server_url)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/auth/login_command.py", line 139, in run_login_command
    return asyncio.run(login_command(server_url))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/auth/login_command.py", line 120, in login_command
    await _fetch_user_data_with_context(
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/auth/login_command.py", line 40, in _fetch_user_data_with_context
    await fetch_user_data_after_oauth(server_url, api_key)
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/auth/api_client.py", line 298, in fetch_user_data_after_oauth
    settings = await client.get_user_settings()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/auth/api_client.py", line 75, in get_user_settings
    return await self._get_json("/api/settings")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/auth/api_client.py", line 56, in _get_json
    return response.json()
           ^^^^^^^^^^^^^^^
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/httpx/_models.py", line 832, in json
    return jsonlib.loads(self.content, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/home/gneubig/.local/bin/openhands", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/entrypoint.py", line 163, in main
    success = run_login_command(args.server_url)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/auth/login_command.py", line 139, in run_login_command
    return asyncio.run(login_command(server_url))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/auth/login_command.py", line 120, in login_command
    await _fetch_user_data_with_context(
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/auth/login_command.py", line 40, in _fetch_user_data_with_context
    await fetch_user_data_after_oauth(server_url, api_key)
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/auth/api_client.py", line 298, in fetch_user_data_after_oauth
    settings = await client.get_user_settings()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/auth/api_client.py", line 75, in get_user_settings
    return await self._get_json("/api/settings")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/openhands_cli/auth/api_client.py", line 56, in _get_json
    return response.json()
           ^^^^^^^^^^^^^^^
  File "/home/gneubig/.local/share/uv/tools/openhands/lib/python3.12/site-packages/httpx/_models.py", line 832, in json
    return jsonlib.loads(self.content, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Expected Behavior

No response

Actual Behavior

No response

Steps to Reproduce

No response

OpenHands CLI Installation Method

CLI (uv tool install)

If you selected "Other", please specify

No response

OpenHands CLI Version

No response

Version Confirmation

  • I have confirmed this bug exists on the LATEST version of OpenHands CLI

Model Name

No response

Operating System

None

Terminal / Shell

No response

Logs and Error Messages

No response

Screenshots and Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions