OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: listen.py line 238, in refresh_files structure = files.get_folder_structure(Path(str(config.workspace_base)))

Open unclemusclez opened this issue 9 months ago • 7 comments

Is there an existing issue for the same bug?

  • [X] I have checked the troubleshooting document at https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting
  • [X] I have checked the existing issues.

Describe the bug

I think it's looking for a symlink? Perhaps -v $WORKSPACE_BASE:/opt/workspace_base is never mounted. Would this have to be configured in the config.toml?

Current Version

0.5.3

Installation and Configuration

Following installation instructions from: https://github.com/OpenDevin/OpenDevin/blob/0.5.3/Development.md

Model and Agent

xingyaow/codeact-agent-mistral:latest CodeAct https://i.imgur.com/wWq9Wnm.png

Reproduction Steps

No response

Logs, Errors, Screenshots, and Additional Context

INFO:     127.0.0.1:54962 - "GET /api/litellm-models HTTP/1.1" 200 OK
INFO:     127.0.0.1:54970 - "GET /api/messages/total HTTP/1.1" 200 OK
INFO:     127.0.0.1:54984 - "GET /api/litellm-models HTTP/1.1" 200 OK
INFO:     127.0.0.1:54948 - "GET /api/refresh-files HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 411, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in __call__
    await self.app(scope, receive, send)
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 776, in app
    await route.handle(scope, receive, send)
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle
    await self.app(scope, receive, send)
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 77, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/home/musclez/.cache/pypoetry/virtualenvs/opendevin-n-3vbtf9-py3.11/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 851, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/p/opendevin/opendevin/server/listen.py", line 238, in refresh_files
    structure = files.get_folder_structure(Path(str(config.workspace_base)))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/p/opendevin/opendevin/runtime/files.py", line 35, in get_folder_structure
    for item in workdir.iterdir():
  File "/usr/lib/python3.11/pathlib.py", line 931, in iterdir
    for name in os.listdir(self):
                ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'workspace'

unclemusclez avatar May 16 '24 17:05 unclemusclez

this is my current config.toml

[core]
workspace_base="./workspace"
workspace_mount_path="/mnt/p/workspace"
volumes=["/mnt/p/workspace:/opt/workspace_base:rw"]

[llm]
model="ollama/xingyaow/codeact-agent-mistral:latest"
api_key="ollama"
base_url="http://host.docker.internal:11434"
embedding_model="local"

I think something is calling $(pwd), and that makes listen.py look for the workspace file in the OpenDevin directory.

In config.toml, I define the workspace_mount_path and volumes.

Because it is looking for a file and not a directory, I performed within OpenDevin directory:

ln -s /mnt/p/workspace ./workspace,

This allowed me to use a different folder outside of the OpenDevin folder, and I am able to see all of the files display in OD's explorer. I'm not sure about OD's browser functionality yet.

unclemusclez avatar May 16 '24 18:05 unclemusclez

There seem to be multiple issues here. First please let's see your installation work.

Perhaps -v $WORKSPACE_BASE:/opt/workspace_base is never mounted. Would this have to be configured in the config.toml?

'volumes' is not a config property to set in the toml, I think it's ignored as you have it, and it mounts instead the workspace_mount_path to a default '/workspace' in the sandbox. (which is configurable with workspace_mount_path_in_sandbox)

I think workspace_base should be an absolute path. Can you please try this?

workspace_mount_path_in_sandbox='/opt/workspace_base'
workspace_base='/mnt/p/workspace/'
workspace_mount_path='/mnt/p/workspace/'

enyst avatar May 16 '24 20:05 enyst

i tried the docker image with the basic-setup instructions from the front-page, same or at least similar error: https://i.imgur.com/KJhISYj.png

'volumes' is not a config property to set in the toml, I think it's ignored as you have it, and it mounts instead the workspace_mount_path to a default '/workspace' in the sandbox. (which is configurable with workspace_mount_path_in_sandbox)

I'm going to crack at the development build someone more. Passing variable through the toml does seem to work.

I have had OD Working multiple times with proper directories displayed and OD able to execute terminal commands. At one point I saw the the browser has a blue dot, but i wasn't paying attention to the active window when troubleshooting the directories. I've never had the UID or the cache set up correctly. That's what i am trying to work on now.

It seems to be the case that when I close out of the environment, certain variables reset. So, if is working, when I shut off my computer, it stops working.

unclemusclez avatar May 16 '24 21:05 unclemusclez

It seems to be the case that when I close out of the environment, certain variables reset.

At least if you ran with docker, opened a terminal and set environment variables with EXPORT, then yes, you may need to set again.

If you want to not touch them anymore, with the development setup you can keep them in toml, and if you need some specific vars that toml doesn't know about (normally not necessary), then you can store them in an .env file in opendevin's directory.

enyst avatar May 16 '24 21:05 enyst

My main concern was that I am creating more of an issue for developers than helping by using the development build. However, I seem have similar issues with either build. So, as long as I'm helping with the information I am gathering, I will continue with the development build and providing feedback.

unclemusclez avatar May 16 '24 22:05 unclemusclez

main build config.toml:

[core]
workspace_base="/mnt/p/workspace"
workspace_mount_path_in_sandbox='/opt/workspace_base'
workspace_mount_path="/mnt/p/workspace"
volumes=["/mnt/p/workspace:/opt/workspace_base:rw"]
sandbox_workspace_dir='/opt/workspace_base'
environment=["$SANDBOX_USER_ID"]
cache_dir="/home/musclez/.cache"
bash_script_path="/mnt/p/opendevin"

[llm]
model="ollama/xingyaow/codeact-agent-mistral:latest"
api_key="ollama"
base_url="http://host.docker.internal:11434"
embedding_model="local"

no errors.

Is the cache folder supposed to be hooked up directly to my host cache folder? its mounted, and i can definitely pass environment variables through the .toml.

unclemusclez avatar May 17 '24 07:05 unclemusclez

i tried the docker image with the basic-setup instructions from the front-page, same or at least similar error: i.imgur.com/KJhISYj.png

image

You can ignore the error.

Did you click workspace? image

SmartManoj avatar May 18 '24 05:05 SmartManoj

In the latest version, the workspace name is hidden. @amanape intentional?

SmartManoj avatar Jun 03 '24 07:06 SmartManoj

Going to close this issue. Please try the latest main and re-open issues if you run into more issues please.

mamoodi avatar Jun 26 '24 14:06 mamoodi