opencommit icon indicating copy to clipboard operation
opencommit copied to clipboard

Error: Request failed with status code 400

Open wudi opened this issue 2 years ago • 14 comments

â—“  Generating the commit message.
│
└  ✖ Error: Request failed with status code 400

It may be that the country I am in is not supported. I can't find where to set it the proxy.

wudi avatar Mar 13 '23 05:03 wudi

hey @wudi

i dont think its the country, you would get smth like 401 or 403. there is an option: file is really big (more than 4096 token).

try commiting different smaller file, if it helps — let me know, i'll check on the that and make error messages more descriptive if possible <3

di-sukharev avatar Mar 13 '23 08:03 di-sukharev

I have the same problem!

homerokzam avatar Mar 14 '23 11:03 homerokzam

I have the same problem!

does commiting smaller file work?

di-sukharev avatar Mar 14 '23 14:03 di-sukharev

Just tested with a small file like "readme" and it is working

aavram93 avatar Mar 14 '23 20:03 aavram93

@homerokzam @wudi does smaller files work for you guys?

di-sukharev avatar Mar 15 '23 06:03 di-sukharev

ok, looks like sending large files in batches to openAI breaks somewhere. Anyone wants to investigate and make a PR? :)

di-sukharev avatar Mar 16 '23 15:03 di-sukharev

I just received this error today with a minor change to one file. I was also able to commit no problem with several larger files earlier today with no error.

evanmarshall-dev avatar Mar 25 '23 21:03 evanmarshall-dev

I have the same error with changed in files which are ~2k I also found out that even if the github page says npm 1.1.24 I am getting 1.1.23 no matter how I force it. It may be a commit issue ?

Eriobis avatar Mar 28 '23 12:03 Eriobis

I received this error today with a minor change to one file. I was also able to commit no problem with several larger files earlier today with no problem.

Not a resolution, but it is definitely related to the number of commits. I restored different staged files and tried again and it worked. However, it is a shame that this limitation exists. Also, it seems to happen 100% of the time when you try to initiate a commit when you have deleted a file/directory from your repo.

evanmarshall-dev avatar Mar 28 '23 13:03 evanmarshall-dev

I can confirm that this Error: Request failed with status code 400 occurs for large changes. I formatted only one html file with 182 lines of code. oc --no-verify does not help. All good for small changes (few lines of code) in multiple files.

cod3cow avatar Mar 28 '23 13:03 cod3cow

Getting the same error with a simple 1 line change to a README.

I used curl on the api to make sure my token worked and there wasn't any network issues. It would be nice if there was a -verbose or -debug flag to get more details on what the error is.

sean-fairchild avatar Mar 29 '23 16:03 sean-fairchild

I'm encountering the same error and I can verify that it's due to a maximum token limit. In my opinion, the error message could be more informative in this scenario.

If you're facing this issue, a possible solution is to remove files with large differences or newly added large files.

adenekan41 avatar Apr 05 '23 02:04 adenekan41

ok, looks like sending large files in batches to openAI breaks somewhere. Anyone wants to investigate and make a PR? :)

What do you think about this?

The algorithm:

  • Shall we check if the maximum token reaches 4096?
  • If so, we can use Langchain's token splitter.
  • The texts could be uploaded in smaller chunks, or a summarizer could be created to generate a commit.

This could nicely overcome the problem.

franyoadam avatar Apr 23 '23 09:04 franyoadam

Stale issue message

github-actions[bot] avatar Jun 02 '23 21:06 github-actions[bot]