All-Hands-AI / OpenHands

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

If all files are deleted, refreshing file UI throws an error #1028

Closed PierrunoYT closed 5 months ago

PierrunoYT commented 5 months ago

Bug Description

After successfully starting the front and backend of the OpenDevin application, an error occurs when trying to select and open files using the /select-file endpoint after requesting to delete the files via the prompt and pressing the reload button inside the workspace field. The error message indicates that the requested files are not found in the specified workspace directory.

Setup and Configuration

Current Version:

commit 51b3ae56c75d3f00bc717849e43a600e54b9683d (HEAD -> main, origin/main, origin/HEAD)
Author: PierrunoYT <95778421+PierrunoYT@users.noreply.github.com>
Date:   Thu Apr 11 04:59:46 2024 +0200

    Add German Translation (#851)

    * Update index.ts

    * Update translation.json

    * Update index.ts

    * Remove comment and ident JSON

    ---------

    Co-authored-by: Jim Su <jimsu@protonmail.com>

My config.toml and environment vars (be sure to redact API keys):

LLM_MODEL="gpt-4-0125-preview"
LLM_API_KEY="XYZ"
LLM_EMBEDDING_MODEL=""
WORKSPACE_DIR="./workspace"
SANDBOX_TYPE="exec"

My model and agent (you can see these settings in the UI):

Commands I ran to install and run OpenDevin:

make build
make run

Steps to Reproduce

  1. Start the front and backend of the OpenDevin application successfully
  2. Request to delete files via the prompt
  3. Press the reload button inside the workspace field
  4. Make a request to the /select-file endpoint with a file parameter (e.g., /select-file?file=web_calculator_design.txt)

Logs, Error Messages, and Screenshots

INFO:     127.0.0.1:60458 - "GET /select-file?file=web_calculator_design.txt HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  ...
  File "/mnt/c/Users/pierr/OpenDevin/opendevin/server/listen.py", line 127, in select_file
    with open(Path(Path(str(config.get('WORKSPACE_DIR'))), file), 'r') as selected_file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'workspace/web_calculator_design.txt'

INFO:     127.0.0.1:60462 - "GET /select-file?file=snakeGame.js HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  ...
  File "/mnt/c/Users/pierr/OpenDevin/opendevin/server/listen.py", line 127, in select_file
    with open(Path(Path(str(config.get('WORKSPACE_DIR'))), file), 'r') as selected_file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'workspace/snakeGame.js'

INFO:     127.0.0.1:60474 - "GET /select-file?file=index.html HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  ...
  File "/mnt/c/Users/pierr/OpenDevin/opendevin/server/listen.py", line 127, in select_file
    with open(Path(Path(str(config.get('WORKSPACE_DIR'))), file), 'r') as selected_file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'workspace/index.html'

INFO:     127.0.0.1:60478 - "GET /refresh-files HTTP/1.1" 200 OK

Additional Context

grafik

rbren commented 5 months ago

I don't understand. Why are you calling /select-file at all? Is that something you're seeing in the network tab?

PierrunoYT commented 5 months ago

I don't understand. Why are you calling /select-file at all? Is that something you're seeing in the network tab?

It's messed up by AI as I used it to fill the template but I don't calling anything I think it's happening in the background. It's happening when I asked to remove all files and then I pressed on the reload button next to the workspace tab and then it throws me this error.

rbren commented 5 months ago

OK that sounds like possible a real bug. If all files are deleted, refreshing the File UI throws an error