OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: Failed to create agent session: ReadTimeout on start up.

Open Jason-233 opened this issue 9 months ago • 9 comments

Is there an existing issue for the same bug? (If one exists, thumbs up or comment on the issue instead).

  • [x] I have checked the existing issues.

Describe the bug and reproduction steps

i followed https://docs.all-hands.dev/modules/usage/installation, ran it with docker on ubuntu24.04. but got this error on start up. i checked exsited issues, and didnt get a solution. like this one. it would be great, if anyone help me figure it out.

OpenHands Installation

Docker command in README

OpenHands Version

0.39

Operating System

Linux

Logs, Errors, Screenshots, and Additional Context

` ~ docker run -it --rm --pull=always
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.39-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.39 0.39: Pulling from all-hands-ai/openhands Digest: sha256:bfdba1ffb63ef488ac394027fa0f181dfe823db315af79ff54bbde588c174519 Status: Image is up to date for docker.all-hands.dev/all-hands-ai/openhands:0.39 Starting OpenHands... Running OpenHands as root 03:01:16 - openhands:INFO: server_config.py:50 - Using config class None INFO: Started server process [8] 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: 192.168.1.239:63725 - "GET /api/options/config HTTP/1.1" 200 OK INFO: 192.168.1.239:63726 - "GET /api/settings HTTP/1.1" 200 OK 03:06:18 - openhands:INFO: manage_conversations.py:193 - Initializing new conversation 03:06:18 - openhands:INFO: manage_conversations.py:90 - Creating conversation 03:06:18 - openhands:INFO: manage_conversations.py:98 - Loading settings 03:06:18 - openhands:INFO: manage_conversations.py:101 - Settings loaded 03:06:18 - openhands:INFO: manage_conversations.py:127 - Loading conversation store 03:06:18 - openhands:INFO: manage_conversations.py:129 - Conversation store loaded 03:06:18 - openhands:INFO: manage_conversations.py:135 - New conversation ID: acc0ef74a877420882b9102331de682f 03:06:18 - openhands:INFO: manage_conversations.py:142 - Saving metadata for conversation acc0ef74a877420882b9102331de682f 03:06:18 - openhands:INFO: manage_conversations.py:154 - Starting agent loop for conversation acc0ef74a877420882b9102331de682f 03:06:18 - openhands:INFO: standalone_conversation_manager.py:249 - maybe_start_agent_loop:acc0ef74a877420882b9102331de682f 03:06:18 - openhands:INFO: standalone_conversation_manager.py:265 - starting_agent_loop:acc0ef74a877420882b9102331de682f 03:06:18 - openhands:INFO: manage_conversations.py:176 - Finished initializing conversation acc0ef74a877420882b9102331de682f 03:06:18 - openhands:INFO: session.py:149 - Enabling default condenser: type='pipeline' condensers=[BrowserOutputCondenserConfig(type='browser_output_masking', attention_window=2), LLMSummarizingCondenserConfig(type='llm', llm_config=LLMConfig(model='openrouter/meta-llama/llama-3-8b-instruct:free', api_key=''(''), base_url='', api_version=None, aws_access_key_id='', aws_secret_access_key='****', aws_region_name=None, openrouter_site_url='https://docs.all-hands.dev/', openrouter_app_name='OpenHands', num_retries=4, retry_multiplier=2, retry_min_wait=5, retry_max_wait=30, timeout=None, max_message_chars=30000, temperature=0.0, top_p=1.0, top_k=None, custom_llm_provider=None, max_input_tokens=4096, max_output_tokens=8192, input_cost_per_token=None, output_cost_per_token=None, ollama_base_url=None, drop_params=True, modify_params=True, disable_vision=None, caching_prompt=True, log_completions=False, log_completions_folder='/app/logs/completions', custom_tokenizer=None, native_tool_calling=None, reasoning_effort='high', seed=None), keep_first=4, max_size=80, max_event_length=10000)] 03:06:18 - openhands:INFO: conversation_summary.py:92 - Auto-generating title for conversation acc0ef74a877420882b9102331de682f INFO: 192.168.1.239:63726 - "POST /api/conversations HTTP/1.1" 200 OK INFO: 192.168.1.239:63726 - "GET /api/conversations/acc0ef74a877420882b9102331de682f HTTP/1.1" 200 OK INFO: ('192.168.1.239', 63750) - "WebSocket /socket.io/?latest_event_id=-1&conversation_id=acc0ef74a877420882b9102331de682f&providers_set=&session_api_key=null&EIO=4&transport=websocket" [accepted] INFO: connection open 03:06:18 - openhands:INFO: listen_socket.py:54 - sio:connect: IB3lxKaaJPTUlNyWAAAB 03:06:18 - openhands:INFO: standalone_conversation_manager.py:123 - join_conversation:acc0ef74a877420882b9102331de682f:IB3lxKaaJPTUlNyWAAAB 03:06:18 - openhands:INFO: standalone_conversation_manager.py:249 - maybe_start_agent_loop:acc0ef74a877420882b9102331de682f 03:06:18 - openhands:INFO: listen_socket.py:118 - Connected to conversation acc0ef74a877420882b9102331de682f with connection_id IB3lxKaaJPTUlNyWAAAB. Replaying event stream... 03:06:18 - openhands:INFO: listen_socket.py:142 - Finished replaying event stream for conversation acc0ef74a877420882b9102331de682f 03:06:19 - openhands:INFO: docker_runtime.py:166 - [runtime acc0ef74a877420882b9102331de682f] Starting runtime with image: docker.all-hands.dev/all-hands-ai/runtime:0.39-nikolaik 03:06:20 - openhands:INFO: docker_runtime.py:170 - [runtime acc0ef74a877420882b9102331de682f] Container started: openhands-runtime-acc0ef74a877420882b9102331de682f. VSCode URL: None 03:06:20 - openhands:INFO: docker_runtime.py:181 - [runtime acc0ef74a877420882b9102331de682f] Waiting for client to become ready at http://host.docker.internal:37354... 03:07:22 - openhands:INFO: docker_runtime.py:187 - [runtime acc0ef74a877420882b9102331de682f] Runtime is ready. 03:07:23 - openhands:INFO: base.py:700 - [runtime acc0ef74a877420882b9102331de682f] Selected repo: None, loading microagents from /workspace/.openhands/microagents (inside runtime) 03:07:23 - openhands:INFO: memory.py:252 - Loading user workspace microagents: [] 03:07:23 - openhands:INFO: utils.py:183 - Added microagent stdio server: fetch 03:07:33 - openhands:INFO: agent_session.py:194 - Agent session start 03:07:33 - openhands:ERROR: session.py:201 - Error creating agent_session: timed out Traceback (most recent call last): File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 101, in map_httpcore_exceptions yield File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 250, in handle_request resp = self._pool.handle_request(req) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py", line 256, in handle_request raise exc from None File "/app/.venv/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py", line 236, in handle_request response = connection.handle_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/httpcore/_sync/connection.py", line 103, in handle_request return self._connection.handle_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 136, in handle_request raise exc File "/app/.venv/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 106, in handle_request ) = self._receive_response_headers(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 177, in _receive_response_headers event = self._receive_event(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 217, in _receive_event data = self._network_stream.read( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/httpcore/_backends/sync.py", line 126, in read with map_exceptions(exc_map): File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit self.gen.throw(value) File "/app/.venv/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ReadTimeout: timed out

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

Traceback (most recent call last): File "/app/openhands/server/session/session.py", line 167, in initialize_agent await self.agent_session.start( File "/app/openhands/server/session/agent_session.py", line 155, in start await add_mcp_tools_to_agent(agent, self.runtime, self.memory, config.mcp) File "/app/openhands/mcp/utils.py", line 186, in add_mcp_tools_to_agent updated_mcp_config = runtime.get_updated_mcp_config(extra_stdio_servers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/openhands/runtime/impl/action_execution/action_execution_client.py", line 371, in get_updated_mcp_config response = self._send_action_server_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 338, in wrapped_f return copy(f, *args, **kw) ^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 477, in call do = self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 378, in iter result = action(retry_state) ^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 400, in self._add_action_func(lambda rs: rs.outcome.result()) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 480, in call result = fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/app/openhands/runtime/impl/action_execution/action_execution_client.py", line 125, in _send_action_server_request return send_request(self.session, method, url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 338, in wrapped_f return copy(f, *args, **kw) ^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 477, in call do = self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 378, in iter result = action(retry_state) ^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 400, in self._add_action_func(lambda rs: rs.outcome.result()) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 480, in call result = fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/app/openhands/runtime/utils/request.py", line 44, in send_request response = session.request(method, url, timeout=timeout, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/openhands/utils/http_session.py", line 31, in request return CLIENT.request(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 825, in request return self.send(request, auth=auth, follow_redirects=follow_redirects) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 914, in send response = self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 942, in _send_handling_auth response = self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 979, in _send_handling_redirects response = self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1014, in _send_single_request response = transport.handle_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 249, in handle_request with map_httpcore_exceptions(): File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit self.gen.throw(value) File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ReadTimeout: timed out `

Jason-233 avatar May 26 '25 03:05 Jason-233

same problem

rondocc avatar May 26 '25 04:05 rondocc

i have switched from windows to linux but i still get the same problem

rondocc avatar May 26 '25 04:05 rondocc

Same problem, lost 1 day with this error :c

NeiroNext avatar May 26 '25 06:05 NeiroNext

same

superkido511 avatar May 26 '25 08:05 superkido511

Hi there folks. Sorry you're running into this issue. What LLMs are you all using? In the post, I see openrouter/meta-llama/llama-3-8b-instruct:free is being used. This won't work with OpenHands. I do think it should error out better, but OpenHands requires a fairly powerful LLM. See some of the recommended models here: https://docs.all-hands.dev/modules/usage/llms#model-recommendations

mamoodi avatar May 26 '25 13:05 mamoodi

Hi there folks. Sorry you're running into this issue. What LLMs are you all using? In the post, I see openrouter/meta-llama/llama-3-8b-instruct:free is being used. This won't work with OpenHands. I do think it should error out better, but OpenHands requires a fairly powerful LLM. See some of the recommended models here: https://docs.all-hands.dev/modules/usage/llms#model-recommendations

i use deepseek-chat but still fail

rondocc avatar May 26 '25 15:05 rondocc

ohmygod im ok now thank all of you

rondocc avatar May 26 '25 15:05 rondocc

@rondocc can you mention what you did to resolve your particular issue?

mamoodi avatar May 26 '25 15:05 mamoodi

@rondocc can you mention what you did to resolve your particular issue?您能说说是如何解决您的特殊问题的吗?

i just create another api use it

rondocc avatar May 26 '25 18:05 rondocc

Hi there folks. Sorry you're running into this issue. What LLMs are you all using? In the post, I see openrouter/meta-llama/llama-3-8b-instruct:free is being used. This won't work with OpenHands. I do think it should error out better, but OpenHands requires a fairly powerful LLM. See some of the recommended models here: https://docs.all-hands.dev/modules/usage/llms#model-recommendations

I use claude 3.7 Sonnet.

superkido511 avatar May 27 '25 06:05 superkido511

Hi there folks. Sorry you're running into this issue. What LLMs are you all using? In the post, I see openrouter/meta-llama/llama-3-8b-instruct:free is being used. This won't work with OpenHands. I do think it should error out better, but OpenHands requires a fairly powerful LLM. See some of the recommended models here: https://docs.all-hands.dev/modules/usage/llms#model-recommendations

i see. i just chose one randomly for test. maybe there is a bug with litellm. i tried its colab ipynb example, but failed to get response from openrouter. i changed to other model like openrouter/deepseek/deepseek-chat-v3-0324 and it worked.

well, it still failed on openhands. i tried serveral combinations of model setting, like this one below. i may try other api providers next.

Image

Jason-233 avatar May 27 '25 08:05 Jason-233

maybe we need an icon to show if the model work

Myles-Liu avatar May 30 '25 03:05 Myles-Liu

maybe we need an icon to show if the model work

I support! At the moment there is an icon above the API key, which is very misleading, I focused on it right away, until I realized that it does not display anything.

NeiroNext avatar Jun 02 '25 08:06 NeiroNext

same problem,i lose 2 days。 I think the docker.all-hands.dev/all-hands-ai/runtime image is just starting up too slowly, so docker.all-hands.dev/all-hands-ai/openhands ends up timing out while waiting for it.

joyol avatar Jun 03 '25 07:06 joyol

I am using all-hands_openhands-lm-32b-v0.1, an all-hands model, designed for use with open hands, and i'm still getting this error.

Daxiongmao87 avatar Jun 05 '25 22:06 Daxiongmao87

same problem,i lose 2 days。 I think the docker.all-hands.dev/all-hands-ai/runtime image is just starting up too slowly, so docker.all-hands.dev/all-hands-ai/openhands ends up timing out while waiting for it.

how do u solve, any solution? i lose 1.5 day...

ShiaoFuk avatar Sep 11 '25 08:09 ShiaoFuk

The solution for this issue is:

sudo iptables -I INPUT 1 -s 172.17.0.0/16 -j ACCEPT
sudo iptables -I INPUT 1 -s 172.18.0.0/16 -j ACCEPT

adshrc avatar Nov 25 '25 17:11 adshrc