All-Hands-AI / OpenHands

🙌 OpenHands: Code Less, Make More
https://all-hands.dev
MIT License
36.94k stars 4.2k forks source link

[Bug]: LLMMalformedActionError for Ollama3:70b, #3298

Closed XitaoLi closed 2 months ago

XitaoLi commented 3 months ago

Is there an existing issue for the same bug?

Describe the bug

The back-end program can't parser the "images_urls" parameter.

Current OpenDevin version

ghcr.io/opendevin/opendevin:latest

Installation and Configuration

$ docker run \
> -it \
> --pull=always \
> --add-host host.docker.internal:host-gateway \
> -e SANDBOX_USER_ID=$(id -u) \
> -e LLM_API_KEY="ollama" \
> -e LLM_BASE_URL="http://host.docker.internal:11434" \
> -e LLM_OLLAMA_BASE_URL="http://host.docker.internal:11434" \
> -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
>  -e DEBUG=1 \
> -v $WORKSPACE_BASE:/opt/workspace_base \
> -v /var/run/docker.sock:/var/run/docker.sock \
> -p 3000:3000 \
> ghcr.io/opendevin/opendevin
latest: Pulling from opendevin/opendevin
Digest: sha256:ecb9f793d304e2127a99da8ce6c4418f2459fb0f0eafb25b5a4146d73e134c40
Status: Image is up to date for ghcr.io/opendevin/opendevin:latest
Starting OpenDevin...
Setting up enduser with id 1012
Docker socket group id: 1002
Creating group with id 1002
Running as enduser
/app/.venv/lib/python3.12/site-packages/llama_cloud/types/metadata_filter.py:20: SyntaxWarning: invalid escape sequence '\*'
  """
15:39:22 - opendevin:INFO: config.py:437 - Config file not found: [Errno 2] No such file or directory: 'config.toml'
INFO:     Started server process [42]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO:     172.17.0.1:53792 - "GET /assets/index-DCjAGmDv.css HTTP/1.1" 404 Not Found
INFO:     172.17.0.1:53802 - "GET /assets/index-Czpp8vma.js HTTP/1.1" 404 Not Found
INFO:     ('172.17.0.1', 53812) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiI5NTAzYjA1OS01ZDYyLTQ4MDMtYTY1YS1lMGVhZjIzZTQ0ZjAifQ.a6AF4Y2NEfXt-WNSFFwokC7cTkYAMwNtZDljnsxH-YY&latest_event_id=4" [accepted]
15:39:30 - opendevin:ERROR: auth.py:27 - Invalid token
INFO:     connection open
INFO:     connection closed
INFO:     ('172.17.0.1', 38444) - "WebSocket /ws" [accepted]
INFO:     connection open
15:39:34 - opendevin:INFO: agent.py:79 - Using runtime: server
15:39:34 - opendevin:INFO: ssh_box.py:135 - SSHBox is running as opendevin user with USER_ID=1012 in the sandbox
15:39:34 - opendevin:INFO: ssh_box.py:178 - Detected initial session.
15:39:34 - opendevin:INFO: ssh_box.py:180 - Creating new Docker container
15:39:34 - opendevin:WARNING: ssh_box.py:578 - Using port forwarding till the enable host network mode of Docker is out of experimental mode.Check the 897th issue on https://github.com/OpenDevin/OpenDevin/issues/ for more information.
15:39:34 - opendevin:INFO: ssh_box.py:586 - Mounting volumes: {'/data1/lxt/OpenDevin/workspace': {'bind': '/workspace', 'mode': 'rw'}, '/tmp/cache': {'bind': '/home/opendevin/.cache', 'mode': 'rw'}}
15:39:34 - opendevin:INFO: ssh_box.py:597 - Container started
15:39:35 - opendevin:INFO: ssh_box.py:613 - waiting for container to start: 1, container status: running
15:39:37 - opendevin:INFO: ssh_box.py:342 - Connecting to SSH session...
15:39:37 - opendevin:INFO: ssh_box.py:345 - You can debug the SSH connection by running: `ssh -v -p 42733 opendevin@localhost` using the password '32cffd34-e1a2-401c-b8d9-ee2fd60c7505'
15:39:39 - opendevin:INFO: ssh_box.py:349 - Connected to SSH session
15:39:41 - opendevin:INFO: agent.py:100 - Creating agent CodeActAgent using LLM ollama/llama2
15:39:41 - opendevin:INFO: mixin.py:42 - Initializing plugins in the sandbox
15:39:42 - opendevin:INFO: mixin.py:30 - Sourced /opendevin/bash.bashrc and ~/.bashrc successfully
15:39:42 - opendevin:INFO: mixin.py:59 - Copied files from [/app/opendevin/runtime/plugins/agent_skills] to [/opendevin/plugins/agent_skills] inside sandbox.
15:39:42 - opendevin:INFO: mixin.py:67 - Initializing plugin [agent_skills] by executing [/opendevin/plugins/agent_skills/setup.sh] in the sandbox.
15:40:03 - opendevin:INFO: mixin.py:85 - Plugin agent_skills initialized successfully
15:40:03 - opendevin:INFO: mixin.py:30 - Sourced /opendevin/bash.bashrc and ~/.bashrc successfully
15:40:03 - opendevin:INFO: mixin.py:59 - Copied files from [/app/opendevin/runtime/plugins/jupyter] to [/opendevin/plugins/jupyter] inside sandbox.
15:40:03 - opendevin:INFO: mixin.py:67 - Initializing plugin [jupyter] by executing [/opendevin/plugins/jupyter/setup.sh] in the sandbox.
15:40:07 - opendevin:INFO: mixin.py:85 - Plugin jupyter initialized successfully
15:40:07 - opendevin:INFO: mixin.py:30 - Sourced /opendevin/bash.bashrc and ~/.bashrc successfully
15:40:07 - opendevin:INFO: browser_env.py:78 - Starting browser env...
15:40:07 - opendevin:ERROR: state.py:127 - Failed to restore state from session: sessions/c82fd05c-53a1-4984-b7d0-8accebd44d96/agent_state.pkl
Error restoring state sessions/c82fd05c-53a1-4984-b7d0-8accebd44d96/agent_state.pkl
15:40:07 - opendevin:INFO: agent_controller.py:140 - [Agent Controller c82fd05c-53a1-4984-b7d0-8accebd44d96] Starting step loop...
INFO:     172.17.0.1:53808 - "GET /api/list-files?path=%2F HTTP/1.1" 200 OK
15:40:15 - opendevin:INFO: browser_env.py:121 - Browser env started.
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/app/opendevin/events/serialization/action.py", line 56, in action_from_dict
    decoded_action = action_class(**args)
                     ^^^^^^^^^^^^^^^^^^^^
TypeError: MessageAction.__init__() got an unexpected keyword argument 'images_urls'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 244, in run_asgi
    result = await self.app(self.scope, self.asgi_receive, self.asgi_send)  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 151, in __call__
    await self.app(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 103, in __call__
    await self.app(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 77, in __call__
    await self.app(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 756, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 776, in app
    await route.handle(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 373, in handle
    await self.app(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 96, in app
    await wrap_app_handling_exceptions(app, session)(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 94, in app
    await func(session)
  File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 348, in app
    await dependant.call(**values)
  File "/app/opendevin/server/listen.py", line 284, in websocket_endpoint
    await session.loop_recv()
  File "/app/opendevin/server/session/session.py", line 63, in loop_recv
    await self.dispatch(data)
  File "/app/opendevin/server/session/session.py", line 147, in dispatch
    event = event_from_dict(data.copy())
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/opendevin/events/serialization/event.py", line 31, in event_from_dict
    evt = action_from_dict(data)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/opendevin/events/serialization/action.py", line 58, in action_from_dict
    raise LLMMalformedActionError(f'action={action} has the wrong arguments')
opendevin.core.exceptions.LLMMalformedActionError: action={'action': 'message', 'args': {'content': 'hi', 'images_urls': []}} has the wrong arguments
INFO:     connection closed

Model and Agent

Operating System

Linux

Reproduction Steps

No response

Logs, Errors, Screenshots, and Additional Context

No response

neubig commented 3 months ago

Hey @XitaoLi , thanks for this. This looks like an error, but it'd be helpful to have more information. If you are able to reproduce this error, could you please do either or both of the following?:

  1. Look in the "logs" directory in the folder where you ran OpenDevin and attach the full log.
  2. Press the "thumbs-down" button on the UI to send feedback in an easily viewable format.

Thank you!

XitaoLi commented 3 months ago

Thanks for your quick response! @neubig

The docker container has been removed, so it's hard to reproduce.

I do not actually know what happened, but changing the mapping port into others except 3000 works. Maybe the 3000 port is served with a main branch instance, which contains the key "image_urls" and triggers this error.

github-actions[bot] commented 2 months ago

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[bot] commented 2 months ago

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

tobitege commented 2 months ago

This issue should be fixed by now with #3665