Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: BadRequestError breaks runtime? #3435

Closed
2 tasks done
tobitege opened this issue Aug 17, 2024 · 6 comments
Closed
2 tasks done

[Bug]: BadRequestError breaks runtime? #3435

tobitege opened this issue Aug 17, 2024 · 6 comments
Labels
bug Something isn't working Stale Inactive for 30 days

Comments

@tobitege
Copy link
Collaborator

Is there an existing issue for the same bug?

Describe the bug

I'm using OpenRouter for months now with Sonnet model.
After getting a BadRequestError, no more chat commands are being answered (3 animated dots keep going), i.e. I have to start a new task (see log for details).

Current OpenDevin version

0.8.3 as of today

Installation and Configuration

- deleted all local docker containers/images
- fetch/pull and make build+run

Model and Agent

  • Model: openrouter/anthropic/claude-3.5-sonnet
  • CodeActAgent

Operating System

WSL

Reproduction Steps

used this prompt:

go to /workspace folder and create a subfolder "temp", change into it, and build a short python program to print the current date

Logs, Errors, Screenshots, and Additional Context

INFO:     127.0.0.1:42698 - "GET /api/list-files HTTP/1.1" 200 OK
18:22:16 - opendevin:INFO: agent_controller.py:164
USER_ACTION
**MessageAction** (source=EventSource.USER)
CONTENT: go to /workspace folder and create a subfolder "temp", change into it, and build a short python program to print the current date
18:22:16 - opendevin:INFO: session.py:138 - Server event
18:22:17 - opendevin:INFO: runtime.py:196 - Reconnecting session
18:22:17 - opendevin:INFO: runtime.py:202 -
------------------------------Container logs (last 10 lines):------------------------------
    |16:16:38 - opendevin:DEBUG: client.py:270 - Command output: On branch main
    |Your branch is behind 'origin/main' by 1 commit, and can be fast-forwarded.
    |  (use "git pull" to update your local branch)
    |
    |nothing to commit, working tree clean
    |
    |opendevin@fcc5b0c4a6d6:/workspace/OpenDevin $
    |INFO:     172.17.0.1:38032 - "POST /execute_action HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:43382 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:43396 - "POST /list_files HTTP/1.1" 200 OK
    |
------------------------------------------------------------------------------------------


==============
CodeActAgent LEVEL 0 LOCAL STEP 6 GLOBAL STEP 6


Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new
LiteLLM.Info: If you need to debug this error, use `litellm.set_verbose=True'.

Traceback (most recent call last):
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/llms/openai.py", line 1026, in completion
    raise e
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/llms/openai.py", line 959, in completion
    return convert_to_model_response_object(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/utils.py", line 5929, in convert_to_model_response_object
    raise raised_exception
Exception

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/main.py", line 1891, in completion
    response = openai_chat_completions.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/llms/openai.py", line 1032, in completion
    raise OpenAIError(status_code=e.status_code, message=str(e))
litellm.llms.openai.OpenAIError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/d/github/OpenDevin/opendevin/controller/agent_controller.py", line 143, in _start_step_loop
    await self._step()
  File "/mnt/d/github/OpenDevin/opendevin/controller/agent_controller.py", line 400, in _step
    action = self.agent.step(self.state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/github/OpenDevin/agenthub/codeact_agent/codeact_agent.py", line 208, in step
    response = self.llm.completion(
               ^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/github/OpenDevin/opendevin/llm/llm.py", line 181, in wrapper
    resp = completion_unwrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/utils.py", line 1084, in wrapper
    raise e
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/utils.py", line 964, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/main.py", line 2704, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/utils.py", line 8324, in exception_type
    raise e
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/utils.py", line 8182, in exception_type
    raise BadRequestError(
litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenrouterException -
18:22:19 - opendevin:ERROR: agent_controller.py:149 - Error while running the agent: litellm.BadRequestError: OpenrouterException -

18:22:19 - opendevin:ERROR: agent_controller.py:150 - Traceback (most recent call last):
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/llms/openai.py", line 1026, in completion
    raise e
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/llms/openai.py", line 959, in completion
    return convert_to_model_response_object(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/utils.py", line 5929, in convert_to_model_response_object
    raise raised_exception
Exception

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/main.py", line 1891, in completion
    response = openai_chat_completions.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/llms/openai.py", line 1032, in completion
    raise OpenAIError(status_code=e.status_code, message=str(e))
litellm.llms.openai.OpenAIError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/d/github/OpenDevin/opendevin/controller/agent_controller.py", line 143, in _start_step_loop
    await self._step()
  File "/mnt/d/github/OpenDevin/opendevin/controller/agent_controller.py", line 400, in _step
    action = self.agent.step(self.state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/github/OpenDevin/agenthub/codeact_agent/codeact_agent.py", line 208, in step
    response = self.llm.completion(
               ^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/github/OpenDevin/opendevin/llm/llm.py", line 181, in wrapper
    resp = completion_unwrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/utils.py", line 1084, in wrapper
    raise e
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/utils.py", line 964, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/main.py", line 2704, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/utils.py", line 8324, in exception_type
    raise e
  File "/home/tobias/.cache/pypoetry/virtualenvs/opendevin-oz9p9M-K-py3.11/lib/python3.11/site-packages/litellm/utils.py", line 8182, in exception_type
    raise BadRequestError(
litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenrouterException -

18:22:19 - opendevin:INFO: agent_controller.py:207
OBSERVATION
ErrorObservation(content='There was an unexpected error while running the agent', observation='error')
18:22:19 - opendevin:INFO: session.py:138 - Server event
18:22:19 - opendevin:INFO: session.py:138 - Server event
INFO:     127.0.0.1:55364 - "GET /api/list-files HTTP/1.1" 200 OK
18:22:20 - opendevin:INFO: runtime.py:196 - Reconnecting session
18:22:20 - opendevin:INFO: runtime.py:202 -
------------------------------Container logs (last 10 lines):------------------------------
    |  (use "git pull" to update your local branch)
    |
    |nothing to commit, working tree clean
    |
    |opendevin@fcc5b0c4a6d6:/workspace/OpenDevin $
    |INFO:     172.17.0.1:38032 - "POST /execute_action HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:43382 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:43396 - "POST /list_files HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:52474 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:52496 - "POST /list_files HTTP/1.1" 200 OK
    |
------------------------------------------------------------------------------------------
INFO:     127.0.0.1:55378 - "GET /api/list-files HTTP/1.1" 200 OK
18:24:19 - opendevin:INFO: agent_controller.py:164
USER_ACTION
**MessageAction** (source=EventSource.USER)
CONTENT: go to /workspace folder and create a subfolder "temp", change into it, and build a short python program to print the current date
18:24:19 - opendevin:INFO: session.py:138 - Server event
18:24:20 - opendevin:INFO: runtime.py:196 - Reconnecting session
18:24:20 - opendevin:INFO: runtime.py:202 -
------------------------------Container logs (last 10 lines):------------------------------
    |nothing to commit, working tree clean
    |
    |opendevin@fcc5b0c4a6d6:/workspace/OpenDevin $
    |INFO:     172.17.0.1:38032 - "POST /execute_action HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:43382 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:43396 - "POST /list_files HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:52474 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:52496 - "POST /list_files HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:52510 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:52496 - "POST /list_files HTTP/1.1" 200 OK
    |
------------------------------------------------------------------------------------------
INFO:     127.0.0.1:42282 - "GET /api/list-files HTTP/1.1" 200 OK
@tobitege tobitege added the bug Something isn't working label Aug 17, 2024
@shubhamofbce
Copy link
Contributor

@tobitege This should be fixed now after #3678 as it looks like an error during llm completion. We can close this if fixed.

@tobitege
Copy link
Collaborator Author

tobitege commented Sep 4, 2024

Thanks for the reminder! Closing this. :)

@enyst
Copy link
Collaborator

enyst commented Sep 26, 2024

Re-opening this. I'm sorry, we need to fix this better, the previous fix had multiple side-effects. The linked issue has details.

Copy link
Contributor

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale Inactive for 30 days label Oct 27, 2024
Copy link
Contributor

github-actions bot commented Nov 3, 2024

This issue was closed because it has been stalled for over 30 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 3, 2024
@enyst
Copy link
Collaborator

enyst commented Dec 7, 2024

This has been fixed by #4575

@enyst enyst closed this as completed Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale Inactive for 30 days
Projects
None yet
Development

No branches or pull requests

3 participants