From 1407327a14e07b82c96ce3563d961d4312a9333a Mon Sep 17 00:00:00 2001 From: Srinath Padmanabhan <17151014+srithreepo@users.noreply.github.com> Date: Tue, 16 Sep 2025 15:39:18 -0700 Subject: [PATCH] Simplify error messages when user runs into daily quotas. (#8556) Co-authored-by: Srinath Padmanabhan --- packages/core/src/utils/errorParsing.test.ts | 28 +++++--------------- packages/core/src/utils/errorParsing.ts | 4 +-- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/packages/core/src/utils/errorParsing.test.ts b/packages/core/src/utils/errorParsing.test.ts index 071ac58ea3..9c71f4d89b 100644 --- a/packages/core/src/utils/errorParsing.test.ts +++ b/packages/core/src/utils/errorParsing.test.ts @@ -149,9 +149,7 @@ describe('parseAndFormatApiError', () => { expect(result).toContain( 'You have reached your daily gemini-2.5-pro quota limit', ); - expect(result).toContain( - 'upgrade to a Gemini Code Assist Standard or Enterprise plan', - ); + expect(result).toContain('upgrade to get higher limits'); }); it('should format a regular 429 API error with standard message for Google auth', () => { @@ -230,9 +228,7 @@ describe('parseAndFormatApiError', () => { expect(result).toContain( 'We appreciate you for choosing Gemini Code Assist and the Gemini CLI', ); - expect(result).not.toContain( - 'upgrade to a Gemini Code Assist Standard or Enterprise plan', - ); + expect(result).not.toContain('upgrade to get higher limits'); }); it('should format a 429 API error with Pro quota exceeded message for Google auth (Legacy tier)', () => { @@ -254,9 +250,7 @@ describe('parseAndFormatApiError', () => { expect(result).toContain( 'We appreciate you for choosing Gemini Code Assist and the Gemini CLI', ); - expect(result).not.toContain( - 'upgrade to a Gemini Code Assist Standard or Enterprise plan', - ); + expect(result).not.toContain('upgrade to get higher limits'); }); it('should handle different Gemini 2.5 version strings in Pro quota exceeded errors', () => { @@ -286,12 +280,8 @@ describe('parseAndFormatApiError', () => { expect(resultPreview).toContain( 'You have reached your daily gemini-2.5-preview-pro quota limit', ); - expect(result25).toContain( - 'upgrade to a Gemini Code Assist Standard or Enterprise plan', - ); - expect(resultPreview).toContain( - 'upgrade to a Gemini Code Assist Standard or Enterprise plan', - ); + expect(result25).toContain('upgrade to get higher limits'); + expect(resultPreview).toContain('upgrade to get higher limits'); }); it('should not match non-Pro models with similar version strings', () => { @@ -349,9 +339,7 @@ describe('parseAndFormatApiError', () => { expect(result).toContain( 'We appreciate you for choosing Gemini Code Assist and the Gemini CLI', ); - expect(result).not.toContain( - 'upgrade to a Gemini Code Assist Standard or Enterprise plan', - ); + expect(result).not.toContain('upgrade to get higher limits'); }); it('should format a regular 429 API error with standard message for Google auth (Standard tier)', () => { @@ -368,8 +356,6 @@ describe('parseAndFormatApiError', () => { expect(result).toContain( 'We appreciate you for choosing Gemini Code Assist and the Gemini CLI', ); - expect(result).not.toContain( - 'upgrade to a Gemini Code Assist Standard or Enterprise plan', - ); + expect(result).not.toContain('upgrade to get higher limits'); }); }); diff --git a/packages/core/src/utils/errorParsing.ts b/packages/core/src/utils/errorParsing.ts index aa15a6524d..ecfc237573 100644 --- a/packages/core/src/utils/errorParsing.ts +++ b/packages/core/src/utils/errorParsing.ts @@ -27,10 +27,10 @@ const getRateLimitErrorMessageGoogleProQuotaFree = ( currentModel: string = DEFAULT_GEMINI_MODEL, fallbackModel: string = DEFAULT_GEMINI_FLASH_MODEL, ) => - `\nYou have reached your daily ${currentModel} quota limit. You will be switched to the ${fallbackModel} model for the rest of this session. To increase your limits, upgrade to a Gemini Code Assist Standard or Enterprise plan with higher limits at https://goo.gle/set-up-gemini-code-assist, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`; + `\nYou have reached your daily ${currentModel} quota limit. You will be switched to the ${fallbackModel} model for the rest of this session. To increase your limits, upgrade to get higher limits at https://goo.gle/set-up-gemini-code-assist, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`; const getRateLimitErrorMessageGoogleGenericQuotaFree = () => - `\nYou have reached your daily quota limit. To increase your limits, upgrade to a Gemini Code Assist Standard or Enterprise plan with higher limits at https://goo.gle/set-up-gemini-code-assist, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`; + `\nYou have reached your daily quota limit. To increase your limits, upgrade to get higher limits at https://goo.gle/set-up-gemini-code-assist, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`; // Legacy/Standard Tier message functions const getRateLimitErrorMessageGooglePaid = (