OpenHands
OpenHands copied to clipboard
Failed connection to server
I followed the description but it didn't work because the server is not reachable. I comformed that Docker is running. Can anyone teach me how to get out of this problem.
open the server terminal and press r + enter to refresh the connection
Are there any logs from the server?
If you've already troubleshooted server socket status, please ignore below steps.
Here are steps to troubleshoot server connectivity and websocket issues:
-
Check if the server is listening:
- Confirm if the server is correctly set up to listen for connections. You can verify this using the following command on Mac and Linux (note:
sudoaccess required):lsof -nP -i4TCP:3000 - Example output indicating the server is listening:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME Python 24241 iamuser 3u IPv4 123456 0t0 TCP 127.0.0.1:3000 (LISTEN) Python 24248 iamuser 3u IPv4 123456 0t0 TCP 127.0.0.1:3000 (LISTEN)
- Confirm if the server is correctly set up to listen for connections. You can verify this using the following command on Mac and Linux (note:
-
Server console log check:
- Check the server's output to ensure it's running correctly? You should see something like this:
uvicorn opendevin.server.listen:app --reload --port 3000 - With the expected output being:
INFO: Uvicorn running on http://127.0.0.1:3000 (Press CTRL+C to quit) INFO: Started reloader process [24241] using WatchFiles INFO: Started server process [24248] INFO: Waiting for application startup. INFO: Application startup complete.
- Check the server's output to ensure it's running correctly? You should see something like this:
-
Testing websocket connection:
- If the server is listening, try testing a websocket connection using the following commands:
brew install websocat websocat ws://127.0.0.1:3000/ws - Keep an eye on the server logs for a new websocket connection. The logs should indicate a successful connection:
INFO: ('127.0.0.1', 59395) - "WebSocket /ws" [accepted] INFO: connection open
- If the server is listening, try testing a websocket connection using the following commands:
-
Reporting Errors:
- If you encounter a stack trace due to an exception on the server side after following the above steps, please paste the stack trace here for further analysis.
If you've already troubleshooted server socket status, please ignore below steps.
Here are steps to troubleshoot server connectivity and websocket issues:
Check if the server is listening:
- Confirm if the server is correctly set up to listen for connections. You can verify this using the following command on Mac and Linux (note:
sudoaccess required):lsof -nP -i4TCP:3000- Example output indicating the server is listening:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME Python 24241 iamuser 3u IPv4 123456 0t0 TCP 127.0.0.1:3000 (LISTEN) Python 24248 iamuser 3u IPv4 123456 0t0 TCP 127.0.0.1:3000 (LISTEN)Server console log check:
- Check the server's output to ensure it's running correctly? You should see something like this:
uvicorn opendevin.server.listen:app --reload --port 3000- With the expected output being:
INFO: Uvicorn running on http://127.0.0.1:3000 (Press CTRL+C to quit) INFO: Started reloader process [24241] using WatchFiles INFO: Started server process [24248] INFO: Waiting for application startup. INFO: Application startup complete.Testing websocket connection:
- If the server is listening, try testing a websocket connection using the following commands:
brew install websocat websocat ws://127.0.0.1:3000/ws- Keep an eye on the server logs for a new websocket connection. The logs should indicate a successful connection:
INFO: ('127.0.0.1', 59395) - "WebSocket /ws" [accepted] INFO: connection openReporting Errors:
- If you encounter a stack trace due to an exception on the server side after following the above steps, please paste the stack trace here for further analysis.
I've got same issue, so I followed your guide, and I received the error message as below.
(OpenDevin) root@a451579031d9:/OpenDevin# uvicorn opendevin.server.listen:app --port 3000
INFO: Started server process [8064]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:3000 (Press CTRL+C to quit)
INFO: ('127.0.0.1', 52480) - "WebSocket /ws" [accepted]
INFO: connection open
Please check Docker is running using `docker ps`.
Error! Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
Failed to stop container: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
Error creating controller.
Error message left on terminal running websocat ws://127.0.0.1:3000/ws
(OpenDevin) root@a451579031d9:/OpenDevin# websocat ws://127.0.0.1:3000/ws
{"error":true,"message":"Error creating controller. Please check Docker is running using `docker ps`."}
Thank you for posting advices. Because I am novice, I cannot find server terminal, I cannot find logs. I tried measures shown above, but unfortunately my system is windows11 and I couldn't use "losf" command.
I retried and found that no container is running. "docker ps" command shows no containers running. I assume that this is the main cause of this problem. How do you guys think?
Here's my computer setups: Windows 11 Pro intel Core i5-8400 Mem 40GB
I also have the same problem, running on Ubuntu 22 on WSL2
@hyeonmini In the case of macOS:
- Ensure that Docker Desktop is running
- In Docker Desktop, under advanced settings check the case βAllow the default Docker socket to be used (requires password)β.
This should resolve the issue.
I also have the same problem, running on Ubuntu 22 on WSL2
@shahab00x , Were able to troubleshoot using https://github.com/OpenDevin/OpenDevin/issues/344#issuecomment-2027840656?
@Fujimon416 , I haven't used Windows machine for a while. Here is a link to understand the commands
Get-NetTCPConnection -State Listen
You want to find if 3000 and 3001 are on the list.
@neeleshbisht99 has a good point. Check if your OS allows socket.
I also have the same problem, running on Ubuntu 22 on WSL2
@shahab00x , Were able to troubleshoot using #344 (comment)?
@Fujimon416 , I haven't used Windows machine for a while. Here is a link to understand the commands
Get-NetTCPConnection -State ListenYou want to find if
3000and3001are on the list.
I tried that but everything looks fine. I think the problem is with docker using a different subnet than wsl and the main network. Is there a way to modify uvicorn opendevin.server.listen:app --port 3000 to access the server over the network rather than the localhost?
Is there a way to modify uvicorn opendevin.server.listen:app --port 3000 to access the server over the network rather than the localhost?
Yup! You should be able to add --host 0.0.0.0
This is becoming a megathread of failed connections π As such it's probably not super helpful.
If anyone is still stuck, please open a new issue with:
- The commands you ran to start the app
- The environment/config variables you used (redacting your API keys)
- Everything output from
uvicornafter running that command - A screenshot of the
/wsitem in the network tab of your browser's console (CMD+Shift+C or CTRL+Shift+C ususally)
Is there a way to modify uvicorn opendevin.server.listen:app --port 3000 to access the server over the network rather than the localhost?
Yup! You should be able to add
--host 0.0.0.0
Yes! It worked.
I changed the VITE_WS_URL environment variable to the external IP address of WSL export VITE_WS_URL=ws://172.28.215.207:3000/ws and also ran this command uvicorn opendevin.server.listen:app --port 3000 --host 0.0.0.0
I've the same problem on mac m1. I use colima as container. Finally fixed it by soft link the socket file as:
sudo ln -s -f /Users/david/.colima/docker.sock /var/run/docker.sock
sudo chmod +r /var/run/docker.sock
Great find! Docker socket issue is common. Did you keep the error message that pointed you to the docker socket issue? Sharing it could help others facing the same problem.
On Sun, Mar 31, 2024, 12:40β―PM david l euler @.***> wrote:
I've the same problem on mac m1. I use colima as container. Finally fixed it by soft link the socket file as:
sudo ln -s -f /Users/david/.colima/docker.sock /var/run/docker.sock sudo chmod +r /var/run/docker.sock
β Reply to this email directly, view it on GitHub https://github.com/OpenDevin/OpenDevin/issues/344#issuecomment-2028818280, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKR3B4RNXVUHJW7IZA46MYTY3A4ATAVCNFSM6AAAAABFOTVCE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRYHAYTQMRYGA . You are receiving this because you commented.Message ID: @.***>
We might need an "alternative setups" section for colima, windows, ollama etc
Also using Colima on M1. I used the following command before make run:
export DOCKER_HOST=unix://$HOME/.colima/docker.sock