From 1b67a02371641fe2f3ed40e9b6a802c92e2c556d Mon Sep 17 00:00:00 2001 From: erio Date: Sun, 15 Mar 2026 18:44:13 +0800 Subject: [PATCH] fix(ops): match "insufficient account balance" in error filter The upstream Gemini API returns "Insufficient account balance" which doesn't contain the substring "insufficient balance". Add explicit match for the full phrase to ensure the filter works correctly. --- backend/internal/handler/ops_error_logger.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/internal/handler/ops_error_logger.go b/backend/internal/handler/ops_error_logger.go index 5fedc13926..040276c1e8 100644 --- a/backend/internal/handler/ops_error_logger.go +++ b/backend/internal/handler/ops_error_logger.go @@ -32,8 +32,9 @@ const ( opsErrNoAvailableAccounts = "no available accounts" opsErrInvalidAPIKey = "invalid_api_key" opsErrAPIKeyRequired = "api_key_required" - opsErrInsufficientBalance = "insufficient balance" - opsErrInsufficientQuota = "insufficient_quota" + opsErrInsufficientBalance = "insufficient balance" + opsErrInsufficientAccountBalance = "insufficient account balance" + opsErrInsufficientQuota = "insufficient_quota" // 上游错误码常量 — 错误分类 (normalizeOpsErrorType / classifyOpsPhase / classifyOpsIsBusinessLimited) opsCodeInsufficientBalance = "INSUFFICIENT_BALANCE" @@ -1233,8 +1234,9 @@ func shouldSkipOpsErrorLog(ctx context.Context, ops *service.OpsService, message // Check if insufficient balance errors should be ignored if settings.IgnoreInsufficientBalanceErrors { - if strings.Contains(bodyLower, opsErrInsufficientBalance) || strings.Contains(bodyLower, opsErrInsufficientQuota) || - strings.Contains(msgLower, opsErrInsufficientBalance) { + if strings.Contains(bodyLower, opsErrInsufficientBalance) || strings.Contains(bodyLower, opsErrInsufficientAccountBalance) || + strings.Contains(bodyLower, opsErrInsufficientQuota) || + strings.Contains(msgLower, opsErrInsufficientBalance) || strings.Contains(msgLower, opsErrInsufficientAccountBalance) { return true } }