Open cgranier opened 6 days ago
It seems you're facing two distinct issues when running the AI-powered project generation process:
The AI attempted to create a file (App.jsx
), but instead created a folder with the same name, causing the process to fail. Additionally, it seems that when you tried to create files manually, the error [WinError 183]
occurred due to a file (.env
) already existing.
This error happens when too much context is passed in a single request to OpenAI's API, exceeding the allowed token limit. The model can only handle a certain number of tokens (which includes your message and its own response), and if that limit is surpassed, it returns the error you're seeing.
Remove incorrect folder: Navigate to the project/frontend
directory and manually delete the App.jsx
folder that was mistakenly created. In PowerShell, you can do this with:
Remove-Item -Recurse -Force .\project\frontend\App.jsx
Ensure .env
file exists properly: If you already created the .env
file manually, confirm its presence and content. If the AI is trying to recreate it, you can avoid this by simply skipping the file creation or renaming the file. If you'd rather let the AI handle it, delete the .env
file before running the process again:
Remove-Item .\project\backend\.env
Reduce context size: Before asking the AI to retry, clear any unnecessary conversation history. If the AI is working through a large sequence of actions and commands, too much context might be sent back and forth, which causes the token limit to be exceeded. A clean start might help avoid exceeding the context limit.
Break the process into smaller chunks: If the project creation process is extensive, try breaking it down into smaller steps rather than letting the AI handle everything in one go. For instance, ask the AI to generate files for one part of the project (e.g., frontend) first, then backend, etc.
Restart the AI from a clean slate: After removing the problematic files and folders, you can restart the process. To avoid exceeding the token limit again, consider guiding the AI through a more concise series of steps.
Manual intervention: Since you mentioned manually creating files, you can continue with this approach. After identifying and fixing the error, manually copy the code for any incomplete or missing files into your project from the terminal or AI output.
Delete problematic folder:
Remove-Item -Recurse -Force .\project\frontend\App.jsx
Delete existing .env
file if needed:
Remove-Item .\project\backend\.env
Restart the AI process: You could clear the context and ask it to start generating files one section at a time, to avoid overwhelming the token limit.
By breaking down the process into smaller steps and manually intervening when errors occur, you should be able to resolve these issues and proceed with your project generation.
System: WINDOWS 11 / VS-Code / PowerShell Terminal
After the /planning state, I asked the AI to /create Generate the project as planned. It then asked me:
Do you want to execute these creation steps? (yes/no): yes
It then proceeded to create a bunch of files and folders until it stopped with an error and asked me if I wanted to try again. Said yes, but same error.
I eventually tracked the error to a file project/frontend/App.jsx that had been created as a folder, instead of a file and was apparently preventing the file creation process from completing.
NOTE: I also created some files by hand, cutting and pasting from the terminal. Attempting to create the files from the AI stopped with the error:
ERROR:root:An unexpected error occurred during creation: [WinError 183] Cannot create a file when that file already exists: 'Project/backend/.env'
At this point, asking the AI to try again returned an Open AI error and crashed:
Error while communicating with OpenAI: Error code: 400 - {'error': {'message': "This model's maximum context length has been exceeded. Please reduce the length of the messages.", 'type': 'invalid_request_error', 'param': 'messages', 'code': 'context_length_exceeded'}}