From d6ce310901290d29f0af80559d610ff423574df5 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 30 Apr 2026 06:06:14 +0800 Subject: [PATCH] fix: correct API key validation logic in handleApiKeySubmit (#25453) Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com> --- packages/cli/src/ui/AppContainer.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/ui/AppContainer.tsx b/packages/cli/src/ui/AppContainer.tsx index f5294ae23e..b196f8a05a 100644 --- a/packages/cli/src/ui/AppContainer.tsx +++ b/packages/cli/src/ui/AppContainer.tsx @@ -875,10 +875,8 @@ Logging in with Google... Restarting Gemini CLI to continue. async (apiKey: string) => { try { onAuthError(null); - if (!apiKey.trim() && apiKey.length > 1) { - onAuthError( - 'API key cannot be empty string with length greater than 1.', - ); + if (!apiKey.trim()) { + onAuthError('API key cannot be empty or whitespace only.'); return; }