-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Cannot read properties of undefined (reading '0') #5
Comments
Hey @graup, thanks for opening this issue! This error typically happens when you don't have the correct value for the OpenAI env variable. I recommend you do a The API key should have no whitespaces and should be in the shape of |
Thanks for your reply! I tried that, same problem. If you have no idea, I'll try checking out your repo and digging into the API response. |
@graup I may try to add a debugging flag to the CLI soon that shows detailed console messages so folks can debug in situations like this. In the meantime, mind trying one more thing for me? I have a feeling it may be extra whitespace so could you do a After all of that, open up a fresh terminal and try it one more time. If it works, then it was whitespace and I should just trim extra whitespace. |
Hi, I understand that you're facing the same issue that I did before. But I was able to fix it by simply restarting my terminal. Sometimes, when the terminal has been running for a while, it can start to experience some glitches or issues with its processes. So, try restarting your terminal and see if that resolves the problem for you too. |
@Nutlope The error appears to be {
json: {
error: {
message: 'You exceeded your current quota, please check your plan and billing details.',
type: 'insufficient_quota',
param: null,
code: null
}
}
} But you need to handle this (or any other) error(s). Stack trace: /usr/local/lib/node_modules/aicommits/bin/aicommits.js:99
const aiCommit = json.choices[0].text;
^
TypeError: Cannot read properties of undefined (reading '0')
at /usr/local/lib/node_modules/aicommits/bin/aicommits.js:99:38
at Generator.next (<anonymous>)
at fulfilled (/usr/local/lib/node_modules/aicommits/bin/aicommits.js:6:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) I tried with another OpenAI account where I have billing setup and got a {
json: {
error: {
message: 'The server had an error while processing your request. Sorry about that!',
type: 'server_error',
param: null,
code: null
}
}
} I tried several times until I got a successful response, so it could be the OpenAI API having issues right now. |
In my case, I had to set up a payment method in my OpenAI account, and regenerate an new API Key. It worked right after. |
The latest release should log the specific error from OpenAI |
OCO_OPENAI_BASE_PATH=https://api.aikey.one/v1,
|
Getting this error. (I have added a new API key from https://platform.openai.com/account/api-keys to my env.)
The text was updated successfully, but these errors were encountered: