diegosouzapw/OmniRoute · error · Error
Subscription fetch: too many redirects
Error message
Subscription fetch: too many redirects
What it means
Error "Subscription fetch: too many redirects" thrown in diegosouzapw/OmniRoute.
Source
Thrown at src/lib/proxySubscription/subscriptionService.ts:341
* handling, and re-validate any redirect target. Throws on non-2xx or a
* blocked target. Each attempt owns its own timeout so a retry after a fast
* failure isn't killed by the previous attempt's timer.
*/
async function doSafeFetch(url: string, headers: Record<string, string>): Promise<string> {
await assertSafeFetchTarget(url);
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), SUBSCRIPTION_FETCH_TIMEOUT_MS);
try {
const res = await fetch(url, { redirect: "manual", signal: controller.signal, headers });
if (res.status >= 300 && res.status < 400) {
const loc = res.headers.get("location");
if (!loc) throw new Error("Subscription fetch redirected without Location");
// Resolve relative redirects and re-validate the target (SSRF guard).
const next = new URL(loc, url).toString();
await assertSafeFetchTarget(next);
const res2 = await fetch(next, { redirect: "manual", signal: controller.signal, headers });
if (res2.status >= 300 && res2.status < 400) {
throw new Error("Subscription fetch: too many redirects");
}
if (!res2.ok) {
throw new Error(`Subscription fetch failed: HTTP ${res2.status}`);
}
return await res2.text();
}
if (!res.ok) {
throw new Error(`Subscription fetch failed: HTTP ${res.status}`);
}
return await res.text();
} finally {
clearTimeout(timeout);
}
}
/**
* Classify a fetch error as retryable. Transient (retry): network/timeout/DNS
* failures, HTTP 5xx, and HTTP 429. Permanent (no retry): 4xx client errorsView on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at src/lib/proxySubscription/subscriptionService.ts:341 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/37ce55508b5dfd5f.
Report an issue: GitHub.