OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Initializing agent (may take up to 10 seconds)...and never get started

Open techsharma2000 opened this issue 2 years ago • 11 comments

(od) C:\devin\git\OpenDevin>uvicorn opendevin.server.listen:app --port 3000 C:\Users\techs\miniconda3\envs\od\lib\site-packages\pydantic_internal_fields.py:151: UserWarning: Field "model_id" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting model_config['protected_namespaces'] = (). warnings.warn( C:\Users\techs\miniconda3\envs\od\lib\site-packages\pydantic_internal_fields.py:151: UserWarning: Field "model_name" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting model_config['protected_namespaces'] = (). warnings.warn( C:\Users\techs\miniconda3\envs\od\lib\site-packages\pydantic_internal_fields.py:151: UserWarning: Field "model_info" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting model_config['protected_namespaces'] = (). warnings.warn( INFO: Started server process [27180] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:3000 (Press CTRL+C to quit)

frontend

C:\devin\git\OpenDevin\frontend>npm run start -- --port 3001

[email protected] start vite --port 3001

VITE v5.2.8 ready in 798 ms

➜ Local: http://localhost:3001/ ➜ Network: use --host to expose ➜ press h + enter to show help

image

techsharma2000 avatar Apr 07 '24 18:04 techsharma2000

@techsharma2000 thanks for the report. Can you open your browser's network tab and look for the /ws endpoint to see what it's doing?

You may want to try modifying the uvicorn command with --host

uvicorn opendevin.server.listen:app --port 3000 --host 0.0.0.0

rbren avatar Apr 07 '24 20:04 rbren

Check log files in ./logs for errors.

foragerr avatar Apr 07 '24 20:04 foragerr

In the same situation, it may be started after multiple attempts, but after successful startup, the input session content will be stuck and unable to progress, and there will be no prompts or logs. There are several situations when make run:

  1. Startup failed, "opendevin:INFO: session.py:38 - WebSocket has been disconnected, sid: 4223ab84-bff9-4880-8af9-6db03910bfcd." The front end will also prompt an error;
  2. startup successful, but you cannot move forward after entering the session, and there is no error log, such as the picture here; image image

LM Studio logs----------------------------------------------- [2024-04-08 09:17:37.098] [INFO] [LM STUDIO SERVER] Processing queued request... [2024-04-08 09:17:37.099] [INFO] Received POST request to /v1/chat/completions with body: { "messages": [ { "content": "\nYou're a thoughtful robot. Your main task is this:\n\nUse python to write a snake game\n\nDon't expand the scope of your task--just complete it as written.\n\nThis is your internal monologue, in JSON format:\n\n[\n {\n "action": "think",\n "args": {\n "thought": "I exist!"\n },\n "message": "I exist!"\n },\n {\n "action": "think",\n "args": {\n "thought": "Hmm...looks like I can type in a command line prompt"\n },\n "message": "Hmm...looks like I can type in a command line prompt"\n },\n {\n "action": "think",\n "args": {\n "thought": "Looks like I have a web browser too!"\n },\n "message": "Looks like I have a web browser too!"\n },\n {\n "action": "think",\n "args": {\n "thought": "Here's what I want to do: Use python to write a snake game"\n },\n "message": "Here's what I want to do: Use python to write a snake game"\n },\n {\n "action": "think",\n "args": {\n "thought": "How am I going to get there though?"\n },\n "message": "How am I going to get there though?"\n },\n {\n "action": "think",\n "args": {\n "thought": "It seems like I have some kind of short term memory."\n },\n "message": "It seems like I have some kind of short term memory."\n },\n {\n "action": "think",\n "args": {\n "thought": "Each of my thoughts seems to be stored in a JSON array."\n },\n "message": "Each of my thoughts seems to be stored in a JSON array."\n },\n {\n "action": "think",\n "args": {\n "thought": "It seems whatever I say next will be added as an object to the list."\n },\n "message": "It seems whatever I say next will be added as an object to the list."\n },\n {\n "action": "think",\n "args": {\n "thought": "But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process."\n },\n "message": "But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process."\n },\n {\n "action": "think",\n "args": {\n "thought": "Fortunately I have long term memory!"\n },\n "message": "Fortunately I have long term memory!"\n },\n {\n "action": "think",\n "args": {\n "thought": "I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!"\n },\n "message": "I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!"\n },\n {\n "action": "think",\n "args": {\n "thought": "Sometimes they're random thoughts that don't really have to do with what I wanted to remember. But usually they're exactly what I need!"\n },\n "message": "Sometimes they're random thoughts that don't really have to do with what I wanted to remember. But usually they're exactly what I need!"\n },\n {\n "action": "think",\n "args": {\n "thought": "Let's try it out!"\n },\n "message": "Let's try it out!"\n },\n {\n "action": "recall",\n "args": {\n "query": "what it is I want to do"\n },\n "message": "Let me dive into my memories to find what you're looking for! Searching for: 'what it is I want to do'. This might take a moment."\n },\n {\n "observation": "recall",\n "content": "Here's what I want to do: Use python to write a snake game",\n "extras": {\n "memories": [],\n "role": "assistant"\n },\n "message": "The agent recalled memories."\n },\n {\n "action": "think",\n "args": {\n "thought": "How am I going to get there though?"\n },\n "message": "How am I going to get there though?"\n },\n {\n "action": "think",\n "args": {\n "thought": "Neat! And it looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!"\n },\n "message": "Neat! And it looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!"\n },\n {\n "action": "run",\n "args": {\n "command": "echo \"hello world\"",\n "background": false\n },\n "message": "Running command: echo \"hello world\""\n },\n {\n "observation": "run",\n "content": "hello world",\n "extras": {\n "command_id": 0,\n "command": "",\n "exit_code": 0\n },\n "message": "Command executed with exit code 0.\"\n },\n {\n \"action\": \"think\",\n \"args\": {\n \"thought\": \"Cool! I bet I can write files too using the write action.\"\n },\n \"message\": \"Cool! I bet I can write files too using the write action.\"\n },\n {\n \"action\": \"write\",\n \"args\": {\n \"path\": \"test.js\",\n \"content\": \"echo \\\"console.log('hello world')\\\"\"\n },\n \"message\": \"Writing file: test.js\"\n },\n {\n \"action\": \"think\",\n \"args\": {\n \"thought\": \"\"\n },\n \"message\": \"\"\n },\n {\n \"action\": \"think\",\n \"args\": {\n \"thought\": \"I just created test.js. I'll try and run it now.\"\n },\n \"message\": \"I just created test.js. I'll try and run it now.\"\n },\n {\n \"action\": \"run\",\n \"args\": {\n \"command\": \"node test.js\",\n \"background\": false\n },\n \"message\": \"Running command: node test.js\"\n },\n {\n \"observation\": \"run\",\n \"content\": \"hello world\",\n \"extras\": {\n \"command_id\": 0,\n \"command\": \"\",\n \"exit_code\": 0\n },\n \"message\": \"Command executed with exit code 0."\n },\n {\n "action": "think",\n "args": {\n "thought": "It works!"\n },\n "message": "It works!"\n },\n {\n "action": "think",\n "args": {\n "thought": "I'm going to try reading it now using the read action."\n },\n "message": "I'm going to try reading it now using the read action."\n },\n {\n "action": "read",\n "args": {\n "path": "test.js"\n },\n "message": "Reading file: test.js"\n },\n {\n "observation": "read",\n "content": "console.log('hello world')",\n "extras": {\n "path": ""\n },\n "message": "I read the file ."\n },\n {\n "action": "think",\n "args": {\n "thought": "Nice! I can read files too!"\n },\n "message": "Nice! I can read files too!"\n },\n {\n "action": "think",\n "args": {\n "thought": "And if I want to use the browser, I just need to use the browse action and include the url I want to visit in the url argument"\n },\n "message": "And if I want to use the browser, I just need to use the browse action and include the url I want to visit in the url argument"\n },\n {\n "action": "think",\n "args": {\n "thought": "Let's try that..."\n },\n "message": "Let's try that..."\n },\n {\n "action": "browse",\n "args": {\n "url": "google.com"\n },\n "message": "Browsing URL: google.com"\n },\n {\n "observation": "browse",\n "content": "

<input type=\"text\"><button type=\"submit\">
",\n "extras": {\n "url": "",\n "status_code": 200,\n "error": false\n },\n "message": "Visited "\n },\n {\n "action": "think",\n "args": {\n "thought": "I can browse the web too!"\n },\n "message": "I can browse the web too!"\n },\n {\n "action": "think",\n "args": {\n "thought": "And once I have completed my task, I can use the finish action to stop working."\n },\n "message": "And once I have completed my task, I can use the finish action to stop working."\n },\n {\n "action": "think",\n "args": {\n "thought": "But I should only use the finish action when I'm absolutely certain that I've completed my task and have tested my work."\n },\n "message": "But I should only use the finish action when I'm absolutely certain that I've completed my task and have tested my work."\n },\n {\n "action": "think",\n "args": {\n "thought": "Very cool. Now to accomplish my task."\n },\n "message": "Very cool. Now to accomplish my task."\n },\n {\n "action": "think",\n "args": {\n "thought": "I'll need a strategy. And as I make progress, I'll need to keep refining that strategy. I'll need to set goals, and break them into sub-goals."\n },\n "message": "I'll need a strategy. And as I make progress, I'll need to keep refining that strategy. I'll need to set goals, and break them into sub-goals."\n },\n {\n "action": "think",\n "args": {\n "thought": "In between actions, I must always take some time to think, strategize, and set new goals. I should never take two actions in a row."\n },\n "message": "In between actions, I must always take some time to think, strategize, and set new goals. I should never take two actions in a row."\n },\n {\n "action": "think",\n "args": {\n "thought": "OK so my task is to Use python to write a snake game. I haven't made any progress yet. Where should I start?"\n },\n "message": "OK so my task is to Use python to write a snake game. I haven't made any progress yet. Where should I start?"\n },\n {\n "action": "think",\n "args": {\n "thought": "It seems like there might be an existing project here. I should probably start by running ls to see what's here."\n },\n "message": "It seems like there might be an existing project here. I should probably start by running ls to see what's here."\n }\n]\n\n\nYour most recent thought is at the bottom of that monologue. Continue your train of thought.\nWhat is your next thought or action? Your response must be in JSON format.\nIt must be an object, and it must contain two fields:\n* action, which is one of the actions below\n* args, which is a map of key-value pairs, specifying the arguments for that action\n\nHere are the possible actions:\n* read - reads the content of a file. Arguments:\n * path - the path of the file to read\n* write - writes the content to a file. Arguments:\n * path - the path of the file to write\n * content - the content to write to the file\n* run - runs a command. Arguments:\n * command - the command to run\n * background - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with &, just set this to true.\n* kill - kills a background command\n * id - the ID of the background command to kill\n* browse - opens a web page. Arguments:\n * url - the URL to open\n* recall - recalls a past memory. Arguments:\n * query - the query to search for\n* think - make a plan, set a goal, or record your thoughts. Arguments:\n * thought - the thought to record\n* finish - if you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.\n\n\n\nYou MUST take time to think in between read, write, run, browse, and recall actions.\nYou should never act twice in a row without thinking. But if your last several\nactions are all "think" actions, you should consider taking a different action.\n\nNotes:\n* your environment is Debian Linux. You can install software with apt\n* your working directory will not change, even if you run cd. All commands will be run in the /workspace directory.\n* don't run interactive commands, or commands that don't return (e.g. node server.js). You may run commands in the background (e.g. node server.js &)\n\nWhat is your next thought or action? Again, you must reply with JSON, and only with JSON.\n\nYou've been thinking a lot lately. Maybe it's time to take action?\n", "role": "user" } ], "model": "Qwen1.5-14B-Chat-GGUF/qwen1_5-14b-chat-q5_k_m.gguf" } [2024-04-08 09:17:37.111] [INFO] [LM STUDIO SERVER] Last message: { role: 'user', content: ' You're a thoughtful robot. Your main task is this:

Use python to write a snake game

Don't expand ... (truncated in these logs)' } (total messages = 1)

System environment:----------------------------------------- Windows 10 wsl ubuntu-22.04+LM Studio.

zhonggegege avatar Apr 08 '24 01:04 zhonggegege

I meet the same situation,and logs show as follows. 1712559984627

Zhaitizi avatar Apr 08 '24 07:04 Zhaitizi

Also reported here 859

nullnuller avatar Apr 08 '24 09:04 nullnuller

9:10:30 - opendevin:INFO: sandbox.py:308 - Container started 19:10:31 - opendevin:ERROR: manager.py:134 - Error creating controller. Traceback (most recent call last): File "/home/sharma/devin/OpenDevin/opendevin/server/agent/manager.py", line 125, in create_controller self.controller = AgentController( File "/home/sharma/devin/OpenDevin/opendevin/controller/agent_controller.py", line 86, in init self.command_manager = CommandManager( File "/home/sharma/devin/OpenDevin/opendevin/controller/command_manager.py", line 14, in init self.shell = DockerInteractive( File "/home/sharma/devin/OpenDevin/opendevin/sandbox/sandbox.py", line 142, in init raise NotImplementedError( NotImplementedError: Running as root is not supported at the moment. 19:10:57 - opendevin:ERROR: auth.py:18 - Error decoding token: Not enough segments Traceback (most recent call last): File "/home/sharma/anaconda3/envs/od/lib/python3.10/site-packages/jwt/api_jws.py", line 257, in _load signing_input, crypto_segment = jwt.rsplit(b".", 1) ValueError: not enough values to unpack (expected 2, got 1)

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

Traceback (most recent call last): File "/home/sharma/devin/OpenDevin/opendevin/server/auth/auth.py", line 12, in get_sid_from_token payload = jwt.decode(token, JWT_SECRET, algorithms=["HS256"]) File "/home/sharma/anaconda3/envs/od/lib/python3.10/site-packages/jwt/api_jwt.py", line 210, in decode decoded = self.decode_complete( File "/home/sharma/anaconda3/envs/od/lib/python3.10/site-packages/jwt/api_jwt.py", line 151, in decode_complete decoded = api_jws.decode_complete( File "/home/sharma/anaconda3/envs/od/lib/python3.10/site-packages/jwt/api_jws.py", line 198, in decode_complete payload, signing_input, header, signature = self._load(jwt) File "/home/sharma/anaconda3/envs/od/lib/python3.10/site-packages/jwt/api_jws.py", line 260, in _load raise DecodeError("Not enough segments") from err jwt.exceptions.DecodeError: Not enough segments

techsharma2000 avatar Apr 08 '24 13:04 techsharma2000

@techsharma2000 the error you see has been fixed, please update your repository and re-run make build.

If you have further issues, please open another issue and fill in the template.

enyst avatar Apr 08 '24 13:04 enyst

thanks @enyst for your resonse, however I have updated repo now however I am getting below error and UI textbox is disabled. image

techsharma2000 avatar Apr 08 '24 14:04 techsharma2000

If you have further issues, please open another issue and fill in the template.

@techsharma2000 , run git log --format="%h | %cr" -n 1 or the below code and paste the clipboard content here.

import subprocess

def run(command):
    return subprocess.run(command, shell=True, capture_output=True).stdout.decode('utf-8')

try: 
    from pyperclip import copy
except ImportError:
    subprocess.run('pip install pyperclip --user', shell=True)
    from pyperclip import copy

commands = {
    'version' : 'git log --format="%h | %cr" -n 1'
}

for command in commands:
    commands[command] = run(commands[command])

output = ''
for command in commands:
    output += f'{command}: {commands[command]}\n'

output = output.strip()
copy(output)

SmartManoj avatar Apr 09 '24 05:04 SmartManoj

If you have further issues, please open another issue and fill in the template.

@techsharma2000 , run git log --format="%h | %cr" -n 1 or the below code and paste the clipboard content here.

import subprocess

def run(command):
    return subprocess.run(command, shell=True, capture_output=True).stdout.decode('utf-8')

try: 
    from pyperclip import copy
except ImportError:
    subprocess.run('pip install pyperclip --user', shell=True)
    from pyperclip import copy

commands = {
    'version' : 'git log --format="%h | %cr" -n 1'
}

for command in commands:
    commands[command] = run(commands[command])

output = ''
for command in commands:
    output += f'{command}: {commands[command]}\n'

output = output.strip()
copy(output)

I am facing the same problem. When I run it i got the following:

3c4b3ed | 13 hours ago

mohammedrbaker avatar Apr 09 '24 11:04 mohammedrbaker

@techsharma2000 the error you see has been fixed, please update your repository and re-run make build.

If you have further issues, please open another issue and fill in the template.

@enyst Would you know what commit or PR fixed the "not enough segments" issue?

foragerr avatar Apr 09 '24 14:04 foragerr

@enyst Would you know what commit or PR fixed the "not enough segments" issue?

I was referring to the error before it,

File "/home/sharma/devin/OpenDevin/opendevin/sandbox/sandbox.py", line 142, in init
raise NotImplementedError(
NotImplementedError: Running as root is not supported at the moment.

I think I've seen in passing this segments one, but running again has just cleared it for me. I am not sure if it was fixed or it was due to me running an outdated frontend sometimes. Like, I sometimes don't restart frontend, just refresh the page. Could that be the cause?

enyst avatar Apr 09 '24 15:04 enyst

the majority of these issues have been fixed, please update your repository and re-run make build.

If you have further issues, please open another issue and fill in the template.

anasdorbani avatar Apr 09 '24 15:04 anasdorbani

I also tried to run it as root (remote server) but fails with:

Exception: Failed to create opendevin user in sandbox: b'useradd: UID 0 is not unique\n'

kroggen avatar Apr 10 '24 02:04 kroggen

@kroggen stop docker, maybe even delete the container from it, and rebuild / restart. If you still have issues please open a new topic, and fill in the information.

enyst avatar Apr 10 '24 04:04 enyst