fix: handle ByteString conversion errors in OpenAI embedders#8008
Merged
fix: handle ByteString conversion errors in OpenAI embedders#8008
Conversation
src/package.json
Outdated
Contributor
There was a problem hiding this comment.
Is this keybinding addition intentional for this PR? It seems unrelated to the ByteString error fix. Consider moving this to a separate PR to keep changes focused on the issue being fixed.
Contributor
There was a problem hiding this comment.
Good implementation of the error handler! Could we also add a test case for this in the OpenAI embedder's test file to ensure the ByteString error is properly handled here as well? I see we have a test for openai-compatible.spec.ts but not for the regular OpenAI embedder.
Contributor
There was a problem hiding this comment.
Excellent use of the existing error handler! The try-catch pattern here is clean and consistent with the codebase.
- Apply handleOpenAIError to OpenAI client creation in both openai.ts and openai-compatible.ts embedders - Transforms cryptic ByteString errors into user-friendly messages when API keys contain invalid characters - Add test coverage for the ByteString error scenario - Fixes #7959
c1a168d to
3a7f4bf
Compare
mrubens
approved these changes
Sep 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the ByteString conversion error that occurs when users configure code indexing with API keys containing special characters.
Problem
Users were encountering a cryptic error message:
Solution
Applied the existing
handleOpenAIErrorfunction to all embedders that create OpenAI client instances:Changes Made:
Result
Now when users have an API key with invalid characters, they receive a clear, actionable error message:
Testing
Fixes #7959
Important
Fix ByteString conversion error in OpenAI embedders by applying error handling for API keys with special characters.
handleOpenAIErrortoOpenAICompatibleEmbedderinopenai-compatible.tsandOpenAiEmbedderinopenai.tsto handle ByteString conversion errors.openai-compatible.spec.tsfor handling ByteString conversion errors with invalid API keys.roo-cline.addToContextinpackage.json.This description was created by
for c1a168d48b31cdf1c55a3e8fa93ec8beb152d9e5. You can customize this summary. It will automatically update as commits are pushed.