I'm using the CLI via `uvx --python 3.12 openhands...
# feedback
f
I'm using the CLI via
uvx --python 3.12 openhands
and consistently getting this error when the condenser kicks in -- CC @quick-window-91705 do you have any ideas what might cause this?
Copy code
Error: Conversation run failed for id=01223915-11fe-4ddf-a85b-512e8d151308: litellm.AuthenticationError: AnthropicException - {"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"},"request_id":"req_011CUfHimDAGUWwq64sfZJ3z"}
Full stack trace ๐Ÿงต
๐Ÿ‘€ 1
Copy code
Traceback (most recent call last):
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/litellm/llms/anthropic/chat/handler.py", line 445, in completion
    response = client.post(
               ^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/litellm/llms/custom_httpx/http_handler.py", line 836, in post
    raise e
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/litellm/llms/custom_httpx/http_handler.py", line 818, in post
    response.raise_for_status()
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/httpx/_models.py", line 829, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '401 Unauthorized' for url 'https://api.anthropic.com/v1/messages'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/litellm/main.py", line 2324, in completion
    response = anthropic_chat_completions.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/litellm/llms/anthropic/chat/handler.py", line 460, in completion
    raise AnthropicError(
litellm.llms.anthropic.common_utils.AnthropicError: {"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"},"request_id":"req_011CUfHimDAGUWwq64sfZJ3z"}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/openhands/sdk/conversation/impl/local_conversation.py", line 264, in run
    self.agent.step(self, on_event=self._on_event)
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/openhands/sdk/agent/agent.py", line 121, in step
    condensation_result = self.condenser.condense(view)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/openhands/sdk/context/condenser/base.py", line 91, in condense
    return self.get_condensation(view)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/openhands/sdk/context/condenser/llm_summarizing_condenser.py", line 66, in get_condensation
    llm_response = self.llm.completion(
                   ^^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/openhands/sdk/llm/llm.py", line 498, in completion
    resp = _one_attempt()
           ^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/tenacity/__init__.py", line 338, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/tenacity/__init__.py", line 477, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/tenacity/__init__.py", line 378, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/tenacity/__init__.py", line 400, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/tenacity/__init__.py", line 480, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/openhands/sdk/llm/llm.py", line 479, in _one_attempt
    resp = self._transport_call(messages=formatted_messages, **final_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/openhands/sdk/llm/llm.py", line 666, in _transport_call
    ret = litellm_completion(
          ^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/litellm/utils.py", line 1371, in wrapper
    raise e
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/litellm/utils.py", line 1244, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/litellm/main.py", line 3767, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2273, in exception_type
    raise e
  File "/home/hoang/.cache/uv/archive-v0/GpvbCSzbI1XFsoJGqcOia/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 594, in exception_type
    raise AuthenticationError(
litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AnthropicException - {"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"},"request_id":"req_011CUfHimDAGUWwq64sfZJ3z"}
Another issue I notice is that somehow when I attempt to disable the condenser via advanced settings, its status is still
enabled
after restart
q
Thanks for pointing this out! Will be fixing this
๐Ÿ™Œ 1
ty 1
https://github.com/OpenHands/OpenHands/pull/11587 - patching the condenser llm api key issue here