gpt-engineer icon indicating copy to clipboard operation
gpt-engineer copied to clipboard

KeyError: 'main_prompt' problem with GPT Engineer

Open SMSaikatMondal opened this issue 2 years ago • 4 comments

I am getting the following error:

My Input: python -m gpt_engineer.main example My OS: Windows11 Python version: 3.11.4 pip version: 23.1.2

File "", line 198, in _run_module_as_main

File "", line 88, in _run_code

File "C:\Users\Saikat\gpt-engineer\gpt_engineer\main.py", line 65, in app()

File "C:\Users\Saikat\gpt-engineer\gpt_engineer\main.py", line 60, in main messages = step(ai, dbs) ^^^^^^^^^^^^^

File "C:\Users\Saikat\gpt-engineer\gpt_engineer\steps.py", line 37, in clarify user = dbs.input["main_prompt"] ~~~~~~~~~^^^^^^^^^^^^^^^

File "C:\Users\Saikat\gpt-engineer\gpt_engineer\db.py", line 21, in getitem raise KeyError(key)

KeyError: 'main_prompt'

SMSaikatMondal avatar Jun 23 '23 10:06 SMSaikatMondal

The example folder should exist and in it should there be a main_prompt file. Its gives you that error when you feed it a file that does not exist.

abcdefghijorngarbosaxyz avatar Jun 23 '23 14:06 abcdefghijorngarbosaxyz

I had the same problem trying to build the project also. What I did was move the project out of the projects folder as a temporary solution. I still can't get the built projects to run. any suggestions is welcomed.

HulkAi avatar Jun 24 '23 12:06 HulkAi

For some weird reason it works if you name the file 'main_prompt' instead of 'prompt'.

voulkon avatar Jun 24 '23 16:06 voulkon

I'm having the same issue. It worked 45 minutes ago. Something happened and where one used to say main_prompt it now looks like this (after execution of "cp -r projects/example/ projects/my-new-project"} image . Changing the filename appears to work but the result ends up with an error. I forgot to make note of the name/contents of the error I will run it again and edit this post with those details.

Edit. i have two tracebacks. one shows what happens when the file is named "prompt" the other "main_prompt". there was a hang in the middle of the main_prompt attempt. youll see in the traceback where this happened. Tracebacks here: https://justpaste.it/cihuu

IIEleven11 avatar Jun 24 '23 17:06 IIEleven11

I think I may have solved this problem and it comes down to an "s" on the end of "project". The example has the singular yet the path to main_prompt is this plural, "projects"!

Bandit253 avatar Jun 24 '23 23:06 Bandit253

I am very new to all this stuff, but tonight I decided to check for gpt-engineer updates, pulled the latest, and suddenly started having this problem too.

Looks like Installing gpt-engineer now results in /example/prompt being created instead of the former /example/main_prompt, so it fails to start. As said, manually correcting the file to main_prompt allows it to run, but obviously the real fix is somewhere deep in the code and way above my ability.

ScaryFastca avatar Jun 25 '23 01:06 ScaryFastca

I am very new to all this stuff, but tonight I decided to check for gpt-engineer updates, pulled the latest, and suddenly started having this problem too.

Looks like Installing gpt-engineer now results in /example/prompt being created instead of the former /example/main_prompt, so it fails to start. As said, manually correcting the file to main_prompt allows it to run, but obviously the real fix is somewhere deep in the code and way above my ability.

Were you able to complete a full run without error by changing it to main_prompt? Mine would start but eventually fail

IIEleven11 avatar Jun 25 '23 02:06 IIEleven11

For me I obtained that error when I didn't create the virtual environment properly. Try running source venv/bin/activate after make install?

JungeWerther avatar Jun 25 '23 10:06 JungeWerther

There was a bug on main. Should not happen!

It's fixed now, let's make sure it doesn't happen again.

AntonOsika avatar Jun 25 '23 14:06 AntonOsika

Closing now, please immediately open a new issue if this is not fix still!

AntonOsika avatar Jun 25 '23 14:06 AntonOsika