decolua/9router · error
Bing translator fetch failed: ${res.status}
Error message
Bing translator fetch failed: ${res.status} What it means
edgeTts getToken() scrapes https://www.bing.com/translator to extract the params_AbusePreventionHelper token and cookies used for Edge TTS synthesis. When the initial fetch returns a non-2xx status, it throws 'Bing translator fetch failed: <status>'. Both token() and synthesize() depend on this, so all Edge TTS synthesis fails until a valid token is obtained.
Source
Thrown at open-sse/handlers/ttsProviders/edgeTts.js:18
// Microsoft Edge / Bing TTS (no auth) — via Bing translator endpoint
import { Buffer } from "node:buffer";
import { UA } from "./_base.js";
const REFRESH_MS = 5 * 60 * 1000; // token TTL ~1h, refresh early
const VOICES_TTL = 24 * 60 * 60 * 1000;
const cache = { token: null, tokenTime: 0 };
let _voicesCache = null;
let _voicesCacheTime = 0;
async function getToken() {
const now = Date.now();
if (cache.token && now - cache.tokenTime < REFRESH_MS) return cache.token;
const res = await fetch("https://www.bing.com/translator", {
headers: { "User-Agent": UA, "Accept-Language": "vi,en-US;q=0.9,en;q=0.8" },
});
if (!res.ok) throw new Error(`Bing translator fetch failed: ${res.status}`);
const rawCookies = res.headers.getSetCookie?.() || [];
const cookie = rawCookies.map((c) => c.split(";")[0]).join("; ");
const html = await res.text();
const match = html.match(/params_AbusePreventionHelper\s*=\s*\[([^,]+),([^,]+),/);
if (!match) throw new Error("Failed to parse Bing token");
cache.token = { key: match[1], token: match[2].replace(/"/g, ""), cookie };
cache.tokenTime = now;
return cache.token;
}
async function ttsRequest(text, voiceId, token) {
const parts = voiceId.split("-");
const xmlLang = parts.slice(0, 2).join("-");
const gender = voiceId.toLowerCase().includes("male") ? "Male" : "Female";
const ssml = `<speak version='1.0' xml:lang='${xmlLang}'><voice xml:lang='${xmlLang}' xml:gender='${gender}' name='${voiceId}'><prosody rate='0.00%'>${text}</prosody></voice></speak>`;
const body = new URLSearchParams();
body.append("ssml", ssml);
body.append("token", token.token);View on GitHub (pinned to 90b52e06ff)
Solutions
- Retry after a delay — transient 429/5xx clears on its own; add exponential backoff
- Check if your server IP is blocked: curl -I https://www.bing.com/translator from the host; a 403 means IP-level blocking
- Route outbound traffic through a residential proxy or run the gateway on a different network
- Set a realistic browser User-Agent / include cookies if the default UA is being rejected
- Fall back to another TTS provider (the repo's other ttsProviders) when Edge TTS is unavailable
Example fix
// before
const token = await edgeTts.synthesize(text, voice);
// after
try {
const token = await edgeTts.synthesize(text, voice);
} catch (e) {
if (String(e.message).includes("Bing translator fetch failed")) {
return fallbackProvider.synthesize(text, voice); // e.g. another ttsProvider
}
throw e;
} Defensive patterns
Strategy: retry
Validate before calling
const pre = await fetch("https://www.bing.com/translator", { method: "HEAD" }).catch(() => null);
if (!pre || !pre.ok) console.warn("Bing translator unreachable from this host — Edge TTS will fail"); Try / catch
try {
const audio = await edgeTts.synthesize(text, voice);
} catch (e) {
if (String(e.message).startsWith("Bing translator fetch failed")) {
await sleep(backoff); return edgeTts.synthesize(text, voice); // or fallback provider
}
throw e;
} Prevention
- Prefer running Edge TTS from residential networks — datacenter IPs are frequently 403'd by Bing
- Implement exponential backoff with jitter for 429/5xx
- Keep another TTS provider configured as a fallback
- Cache synthesized audio to reduce Bing request volume
When it happens
Trigger: bing.com/translator returns 403/429/5xx: datacenter IP blocked or rate-limited by Bing bot detection, region-locked responses, network/proxy failure, or Bing changing/throttling the endpoint.
Common situations: Running the gateway on a cloud server/VPS whose IP range Bing blocks (very common — residential IPs work, datacenter IPs get 403); running behind a corporate proxy that intercepts the request; too-frequent synthesis triggering rate limiting; Bing A/B testing changes the page and later breaks token parsing too.
Related errors
- Failed to parse Bing token
- Edge TTS voices fetch failed: ${res.status}
- Bing TTS failed: ${res.status}${body ? " - " + body : ""}
- ElevenLabs voices fetch failed: ${res.status}
- ElevenLabs TTS failed: ${res.status}
AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30).
Data as JSON: /api/errors/e6bec3584f938894.
Report an issue: GitHub.