Skip to content

Commit 12b4e07

Browse files
superdav42claude
andcommitted
Fail fast on 401/403 auth errors instead of retrying 20 times
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d10cd20 commit 12b4e07

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

scripts/translate.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,11 @@ async function translateWithRetry(text, targetLocale, opts, context = {}, retrie
335335
try {
336336
return await translate(text, targetLocale, opts, context);
337337
} catch (err) {
338+
// Fail immediately on auth/config errors - retrying won't help
339+
if (err.message.includes('API error 401') || err.message.includes('API error 403')) {
340+
console.error(` ✖ Authentication failed for "${contextDesc}": ${err.message}`);
341+
throw err;
342+
}
338343
if (attempt === retries) throw err;
339344
// Exponential backoff: 5s, 10s, 20s, 40s... capped at 5 minutes
340345
const baseDelay = 5000;

0 commit comments

Comments
 (0)