diegosouzapw/OmniRoute · error · Error

Subscription host resolution failed

Error message

Subscription host resolution failed: ${e instanceof Error ? e.message : e}

What it means

DNS resolution failure inside assertSafeFetchTarget(): the node:dns lookup of the subscription hostname threw (NXDOMAIN, no network, resolver timeout, etc.). Unlike the 'blocked address' error, this is a resolution error, not an SSRF rejection, and is treated as retryable upstream.

Solutions

  1. Verify the subscription hostname is spelled correctly and exists in DNS.
  2. Check the machine's DNS resolver/network connectivity.
  3. Retry later if the failure was a transient resolver timeout — the fetch layer classifies this as retryable.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/lib/proxySubscription/subscriptionService.ts:316 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/0857d4bf2a6fad69. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/proxySubscription/subscriptionService.ts:316

  if (!isSubscriptionFetchUrlAllowed(url, guardOpts)) {
    throw new Error("Subscription URL is not allowed (scheme or host blocked)");
  }
  const host = new URL(url).hostname.toLowerCase();
  const bare = host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
  if (!isIpLiteral(bare)) {
    // Hostname: resolve ALL records and refuse if ANY address is internal
    // (fail closed). A hostname can resolve to multiple records; checking only
    // the first would let an internal IP slip through if a public record also
    // exists. `lookup(..., { all: true })` returns every A/AAAA record.
    try {
      const dns = await import("node:dns");
      const addrs = await dns.promises.lookup(bare, { all: true });
      if (isAnyResolvedAddressBlocked(addrs, guardOpts)) {
        throw new Error("Subscription host resolves to a blocked (internal) address");
      }
    } catch (e) {
      if (e instanceof Error && e.message.includes("blocked")) throw e;
      throw new Error(`Subscription host resolution failed: ${e instanceof Error ? e.message : e}`);
    }
  }
}

/**
 * Single fetch attempt: SSRF-validate the target, fetch with manual redirect
 * 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");

View on GitHub (pinned to a179ffed5b)