diff --git a/src/services/api/errors.test.ts b/src/services/api/errors.test.ts index 9c8c9e3f..92508240 100644 --- a/src/services/api/errors.test.ts +++ b/src/services/api/errors.test.ts @@ -17,6 +17,11 @@ describe('image unsupported API errors', () => { 'unsupported modality: image input is not available', ), ).toBe(true) + expect( + isUnsupportedImageInputErrorMessage( + 'Failed to deserialize the JSON body into the target type: messages[1]: unknown variant `image_url`, expected `text` at line 1 column 394097', + ), + ).toBe(true) expect(isUnsupportedImageInputErrorMessage('image exceeds maximum')).toBe(false) }) diff --git a/src/services/api/errors.ts b/src/services/api/errors.ts index c5df6dd1..a77459c6 100644 --- a/src/services/api/errors.ts +++ b/src/services/api/errors.ts @@ -430,6 +430,9 @@ export function extractUnknownErrorFormat(value: unknown): string | undefined { export function isUnsupportedImageInputErrorMessage(message: string): boolean { const raw = message.toLowerCase() if (!raw.includes('image')) return false + if (raw.includes('image_url') && raw.includes('expected') && raw.includes('text')) { + return true + } return ( raw.includes('not support') || raw.includes('not supported') ||