diegosouzapw/OmniRoute · error · SafeOutboundFetchError

NETWORK_ERROR

NETWORK_ERROR

Error message

Outbound request failed for ${targetUrl.toString()}

What it means

Final SafeOutboundFetchError thrown after all retry attempts in safeOutboundFetch were exhausted: every attempt failed with a retryable normalized error (network failure, timeout, 5xx). Code NETWORK_ERROR with the target URL; the underlying cause is attached to the last normalized error.

Solutions

  1. Verify the target host is reachable from the proxy server (DNS, firewall, TLS)
  2. Increase retryConfig.attempts or backoffMs for flaky upstreams
  3. Inspect the attached cause/normalizedError for the real failure of the last attempt
  4. Circuit-break or health-check the upstream endpoint if it is persistently down
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/shared/network/safeOutboundFetch.ts:362 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/a46fba0adf3479b7. Report an issue: GitHub.

Appendix: source

Thrown at src/shared/network/safeOutboundFetch.ts:362

      }

      return response;
    } catch (error) {
      const normalizedError = normalizeFetchFailure(error, targetUrl.toString(), method, attempt);
      const shouldRetry =
        retryConfig.shouldRetryMethod &&
        attempt < retryConfig.attempts &&
        normalizedError.isRetryable;

      if (!shouldRetry) {
        throw normalizedError;
      }

      await sleep(getBackoffDelay(retryConfig.backoffMs, attempt));
    }
  }

  throw new SafeOutboundFetchError(`Outbound request failed for ${targetUrl.toString()}`, {
    code: "NETWORK_ERROR",
    url: targetUrl.toString(),
    method,
    attempts: retryConfig.attempts,
    isRetryable: false,
  });
}

export function getSafeOutboundFetchErrorStatus(error: unknown) {
  if (!(error instanceof SafeOutboundFetchError)) return null;

  if (error.code === "TIMEOUT") return 504;
  if (
    error.code === "INVALID_URL" ||
    error.code === "URL_GUARD_BLOCKED" ||
    error.code === "REDIRECT_BLOCKED"
  ) {
    return 503;

View on GitHub (pinned to a179ffed5b)