-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
App Version
0.0.6085 (1be6fce)
API Provider
OpenAI
Model Used
text-embedding-3-small
π Steps to Reproduce
- Configure the extension to use OpenAI for embeddings.
- Use an OpenAI API key that has run out of credits.
- Start the indexing process for a workspace.
- The indexing process hangs indefinitely with no error message.
π₯ Outcome Summary
Expected: An error message should appear indicating that the OpenAI account has insufficient funds, and the indexing process should stop.
Actual: The indexing process hangs without any error or notification, endlessly retrying in the background.
π οΈ Contributing & Technical Analysis
β
I'm interested in implementing this feature
β
I understand this needs approval before implementation begins
How should this be solved?
The root cause is that the OpenAI embedder classes treat all 429 HTTP errors as retryable rate-limit errors. The application should differentiate between a temporary rate limit and a permanent quota issue.
What will change:
- The error handling logic in
_embedBatchWithRetrieswithinsrc/services/code-index/embedders/openai.tsandsrc/services/code-index/embedders/openai-compatible.tswill be updated. - When a
429error occurs, the error message from the API will be inspected for keywords like "insufficient_quota". - If a quota error is detected, the process will fail immediately with a new, specific error message instead of retrying.
User interaction:
- Instead of the indexer hanging, the user will see a clear error message in the extension explaining that their OpenAI account has insufficient funds.
Acceptance Criteria
Given the user has configured the OpenAI embedder
And their OpenAI account has insufficient quota
When the indexing process is started
Then the process should fail quickly
And a clear error message is displayed, indicating an insufficient quota issue
But the application should not hang or enter a retry loop for this error
Technical Considerations
Implementation approach:
-
Key files to modify:
src/services/code-index/embedders/openai.tssrc/services/code-index/embedders/openai-compatible.tssrc/i18n/locales/en/embeddings.json(to add the new error message)src/services/code-index/embedders/__tests__/openai.spec.ts(to add a new test case)src/services/code-index/embedders/__tests__/openai-compatible.spec.ts(to add a new test case)
-
Integration points: The change is isolated to the embedding-creation logic and its error handling.
-
Similar patterns in codebase: The existing error handling for
401authentication errors in the same files serves as a good pattern for adding this new error condition.
Trade-offs and Risks
Alternatives considered:
- A generic timeout could be implemented, but this would not provide a specific reason for the failure to the user. Distinguishing the error type is a much better user experience.
Potential risks:
- The string matching for "insufficient_quota" might be brittle if OpenAI changes their error messages. The implementation should be flexible enough to check for multiple keywords or error codes if available in the error response body.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status