From b8918c0c1c369a9e914cc718b03ffec880ab8d0c Mon Sep 17 00:00:00 2001 From: Anurag Saxena Date: Sun, 22 Mar 2026 22:31:31 -0400 Subject: [PATCH] fix: treat Kiro 400 'improperly formed request' as model-unavailable (#386) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kiro returns HTTP 400 with 'Improperly formed request (reset after Xs)' when a model is not available on that account's subscription tier. Previously this fell through to COOLDOWN_MS.transient (30s), causing rapid retries on all accounts before failing — all accounts get locked simultaneously with no actual fallback. Treating this as paymentRequired (2min cooldown) ensures: 1. The model is locked on that account for 2min (proper cooldown) 2. The next available account is tried immediately 3. If all accounts hit the same 400, 9Router falls through to the next provider in the combo Fixes #384 --- open-sse/services/accountFallback.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/open-sse/services/accountFallback.js b/open-sse/services/accountFallback.js index 573a5d64..957655c3 100644 --- a/open-sse/services/accountFallback.js +++ b/open-sse/services/accountFallback.js @@ -32,6 +32,12 @@ export function checkFallbackError(status, errorText, backoffLevel = 0) { return { shouldFallback: true, cooldownMs: COOLDOWN_MS.requestNotAllowed }; } + // Kiro: "improperly formed request" = model not available on this account tier + // Treat as paymentRequired (long cooldown) so the model is locked and fallback occurs + if (lowerError.includes("improperly formed request")) { + return { shouldFallback: true, cooldownMs: COOLDOWN_MS.paymentRequired }; + } + // Rate limit keywords - exponential backoff if ( lowerError.includes("rate limit") ||