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]: openhands can not start due to openhands-runtime not found #6105

Open
1 task done
elvis-cai opened this issue Jan 7, 2025 · 17 comments
Open
1 task done

[Bug]: openhands can not start due to openhands-runtime not found #6105

elvis-cai opened this issue Jan 7, 2025 · 17 comments
Labels
bug Something isn't working severity:medium Affecting multiple users

Comments

@elvis-cai
Copy link

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Describe the bug and reproduction steps

07:01:59 - openhands:ERROR: docker_runtime.py:113 - [runtime baa72990a45a48ed876a1ed0cc70b946] Container openhands-runtime-baa72990a45a48ed876a1ed0cc70b946 not found.
INFO:     192.168.215.1:47246 - "GET /api/conversations/baa72990a45a48ed876a1ed0cc70b946/list-files HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 275, in _raise_for_status
    response.raise_for_status()
  File "/app/.venv/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localhost/v1.47/containers/openhands-runtime-baa72990a45a48ed876a1ed0cc70b946/json

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

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/engineio/async_drivers/asgi.py", line 75, in __call__
    await self.other_asgi_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 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 187, in __call__
    raise exc
  File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 185, in __call__
    with collapse_excgroups():
  File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/app/.venv/lib/python3.12/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
    raise exc
  File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 187, in __call__
    response = await self.dispatch_func(request, call_next)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/server/middleware.py", line 157, in __call__
    response = await self._attach_conversation(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/server/middleware.py", line 137, in _attach_conversation
    request.state.conversation = await session_manager.attach_to_conversation(
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/server/session/manager.py", line 197, in attach_to_conversation
    await c.connect()
  File "/app/openhands/server/session/conversation.py", line 43, in connect
    await self.runtime.connect()
  File "/app/openhands/runtime/impl/docker/docker_runtime.py", line 117, in connect
    raise e
  File "/app/openhands/runtime/impl/docker/docker_runtime.py", line 110, in connect
    await call_sync_from_async(self._attach_to_container)
  File "/app/openhands/utils/async_utils.py", line 18, in call_sync_from_async
    result = await coro
             ^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/utils/async_utils.py", line 17, in <lambda>
    coro = loop.run_in_executor(None, lambda: fn(*args, **kwargs))
                                              ^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/runtime/impl/docker/docker_runtime.py", line 297, in _attach_to_container
    self.container = self.docker_client.containers.get(self.container_name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/docker/models/containers.py", line 954, in get
    resp = self.client.api.inspect_container(container_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/docker/api/container.py", line 793, in inspect_container
    return self._result(
           ^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 281, in _result
    self._raise_for_status(response)
  File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 277, in _raise_for_status
    raise create_api_error_from_http_exception(e) from e
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/docker/errors.py", line 39, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation) from e
docker.errors.NotFound: 404 Client Error for http+docker://localhost/v1.47/containers/openhands-runtime-baa72990a45a48ed876a1ed0cc70b946/json: Not Found ("No such container: openhands-runtime-baa72990a45a48ed876a1ed0cc70b946")

OpenHands Installation

Docker command in README

OpenHands Version

0.18

Operating System

None

Logs, Errors, Screenshots, and Additional Context

how to reproduce

docker pull docker.all-hands.dev/all-hands-ai/runtime:0.18-nikolaik

docker run -it --rm --pull=always \
    -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.18-nikolaik \
    -e LOG_ALL_EVENTS=true \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v ~/.openhands-state:/.openhands-state \
    -p 3000:3000 \
    --add-host host.docker.internal:host-gateway \
    --name openhands-app \
    docker.all-hands.dev/all-hands-ai/openhands:0.18
@daidi
Copy link

daidi commented Jan 7, 2025

+1

@MathiasGruber
Copy link

Also getting this error

@elishaROBINSON
Copy link

+1

@MGloder
Copy link

MGloder commented Jan 7, 2025

get this issue yesterday on my local env, and resolve it by setting the docker host; the default sock is under my root env not my user env;

os.environ['DOCKER_HOST'] = 'unix:///home/machinedoll-t8/.docker/desktop/docker.sock'

im in ubuntu 20.04

@daidi
Copy link

daidi commented Jan 7, 2025

get this issue yesterday on my local env, and resolve it by setting the docker host; the default sock is under my root env not my user env;

os.environ['DOCKER_HOST'] = 'unix:///home/machinedoll-t8/.docker/desktop/docker.sock'

im in ubuntu 20.04

I'm using a Mac, and my local socks are set up through a symbolic link to /var/run/docker.sock (so they are same), and it worked fine when I switched to version 0.17.

@mamoodi
Copy link
Collaborator

mamoodi commented Jan 7, 2025

Are you all using Linux?

If you leave it running, despite the error, does OpenHands eventually run? This error may not be fatal but I'll get someone to check.

@mamoodi mamoodi added the severity:medium Affecting multiple users label Jan 7, 2025
@BestWhere
Copy link

BestWhere commented Jan 7, 2025

+1,im in macos

@rbren
Copy link
Collaborator

rbren commented Jan 7, 2025

Does this happen at startup? When starting a new conversation?

@mamoodi
Copy link
Collaborator

mamoodi commented Jan 7, 2025

@BestWhere in Docker Desktop, if you go to Settings > Advanced and enable `Allow the default Docker socket to be used. Does it fix anything? Again, when you start a conversation, it takes a few minutes to first startup.

@BestWhere
Copy link

@BestWhere in Docker Desktop, if you go to Settings > Advanced and enable `Allow the default Docker socket to be used. Does it fix anything? Again, when you start a conversation, it takes a few minutes to first startup.

It doesn't work.

@BestWhere
Copy link

Does this happen at startup? When starting a new conversation?

Yes. This occurred when I was starting a new conversation.
image

@BestWhere
Copy link

get this issue yesterday on my local env, and resolve it by setting the docker host; the default sock is under my root env not my user env;

os.environ['DOCKER_HOST'] = 'unix:///home/machinedoll-t8/.docker/desktop/docker.sock'

im in ubuntu 20.04

I'm using a Mac, and my local socks are set up through a symbolic link to /var/run/docker.sock (so they are same), and it worked fine when I switched to version 0.17.

so brother you mean you fix it by switching to openhands version 0.17?

@srcHan-u
Copy link

srcHan-u commented Jan 7, 2025

I have the same problem. I'm using macos. It would be nice to know what the problem is

@wangyu-ustc
Copy link

+1

@mamoodi
Copy link
Collaborator

mamoodi commented Jan 7, 2025

Hey all. Can you try enabling Advanced Settings and filling in the model and API key there and retrying?

For example for claude model would be anthropic/claude-3-5-sonnet-20241022. For gpt-4o it would be openai/gpt-4o.

I think the basic settings is broken for GPT perhaps. We will get this fixed ASAP if that is the case.

@elvis-cai
Copy link
Author

had a quick test with 0.19. It works for me now


docker pull docker.all-hands.dev/all-hands-ai/runtime:0.19-nikolaik

docker run -it --rm --pull=always \
    -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.19-nikolaik \
    -e LOG_ALL_EVENTS=true \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v ~/.openhands-state:/.openhands-state \
    -p 3000:3000 \
    --add-host host.docker.internal:host-gateway \
    --name openhands-app \
    docker.all-hands.dev/all-hands-ai/openhands:0.19

@mamoodi
Copy link
Collaborator

mamoodi commented Jan 8, 2025

Are others still running into the same issue or has this been resolved by 0.19?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working severity:medium Affecting multiple users
Projects
None yet
Development

No branches or pull requests

10 participants