paul-gauthier / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
12.88k stars 1.24k forks source link

Error - Could not run aider on existing git repo #501

Closed distributev closed 3 months ago

distributev commented 3 months ago

Using the latest version of aider and the script

cd /correct/path/to/existing/git/repo
export OPENAI_API_KEY=sk_correct_api_key
aider --model gpt-4-0125-preview

I get the following error. I can confirm that the network is fine and that there are credits for the API_KEY.

Does aider tries to send any information about the git repo first time that is run - Could this error happen because the git repo is large?

image

paul-gauthier commented 3 months ago

Thanks for trying aider and filing this issue.

It looks like there is a problem connecting to a server involved with the tiktoken library. Either your local network environment is preventing the connection or the server was down.

distributev commented 3 months ago

Strange, I got the same error multiple times on windows, I tried on linux afterwards and it was at least one hour difference between tries. I'll try tomorrow again.

Are you sure that the size of the git repo will not influence the first time that aider is executed on the repo?

paul-gauthier commented 3 months ago

That error message appears to have nothing to do with the repo size. It an an HTTP connection error. The attempt to make an HTTP connection is not succeeding within the allotted time.

distributev commented 3 months ago

OK, thank you I'll try tomorrow and double check that there are no network related obstacles. Thank you for aider, I watched couple of videos on it and I'm eager to try it.

PS - recently I worked with another python/openai related library which was also displaying similar network errors http 404 but actually the root cause was totally unrelated just that the root error was wrapped/displayed as network related error. I saw the root error only after I used curl to call the same end point API.

distributev commented 3 months ago

Hello again,

This morning it is still failing with the same error message as the days before.

From the same command line interface from where aider is not working I did a successful curl request to the https://api.openai.com/v1/chat/completions api so I don't think there is a network error.

In the context of aider what is the role of the tiktoken library executed at the time of aider --model gpt-4-0125-preview ?

do you know what would be the equivalent request url command which aider/tiktoken is executing and which I can use curl to test in the same way I tested https://api.openai.com/v1/chat/completions ?

image

distributev commented 3 months ago

I did couple of more investigations and found this

Could that be the reason? Did you see this before?

image

paul-gauthier commented 3 months ago

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.