Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/providers/utils/openai-error-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import i18n from "../../../i18n/setup"
*/
export function handleOpenAIError(error: unknown, providerName: string): Error {
if (error instanceof Error) {
const msg = error.message || ""
const msg = (error as any)?.error?.metadata?.raw || error.message || ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property path (error as any)?.error?.metadata?.raw does not exist in the OpenAI SDK error structure (version 5.12.2). OpenAI errors typically have properties like error.message, error.status, error.type, and error.code, but not error.error.metadata.raw. This means the expression will always evaluate to undefined and fall back to error.message, making this change functionally equivalent to the original code but with an unsafe type cast that bypasses TypeScript's type checking. To properly extract more detailed error information, you should verify the actual error structure returned by the OpenAI SDK in the scenarios you're trying to improve.

Fix it with Roo Code or mention @roomote and request a fix.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Openrouter at least does include some useful information


// Log the original error details for debugging
console.error(`[${providerName}] API error:`, {
Expand Down
Loading