iOfficeAI/AionUi · error · Error

update.errors.redirectNoLocation

update.errors.redirectNoLocation

Error message

update.errors.redirectNoLocation

What it means

Thrown by fetchWithAllowlistedRedirects when the server responds with a 3xx redirect status but the response has no Location header, making it impossible to follow the redirect chain. The manual redirect-following loop requires a location to compute the next URL (resolved relative to the current URL).

Source

Thrown at packages/desktop/src/process/bridge/updateBridge.ts:303

const fetchWithAllowlistedRedirects = async (rawUrl: string, signal: AbortSignal): Promise<Response> => {
  let current = rawUrl;

  for (let i = 0; i <= MAX_REDIRECTS; i++) {
    await assertAllowedUrl(current);

    const res = await fetch(current, {
      signal,
      redirect: 'manual',
      headers: {
        'User-Agent': DEFAULT_USER_AGENT,
      },
    });

    if (res.status >= 300 && res.status < 400) {
      const location = res.headers.get('location');
      if (!location) {
        throw new Error((await getI18n()).t('update.errors.redirectNoLocation'));
      }
      current = new URL(location, current).toString();
      continue;
    }

    return res;
  }

  throw new Error((await getI18n()).t('update.errors.tooManyRedirects'));
};

const fetchGitHubReleases = async (repo: string, timeoutMs = 30000): Promise<GitHubReleaseApi[]> => {
  const url = `https://api.github.com/repos/${repo}/releases`;

  // 添加超时控制,防止网络问题导致无限等待 / Add timeout to prevent infinite wait on network issues
  const controller = new AbortController();
  const timeoutId = setTimeout(() => controller.abort(), timeoutMs);

View on GitHub (pinned to 711aa0550e)

Solutions

  1. curl -I the failing URL and inspect the 3xx response for a Location header
  2. Fix the server/proxy to emit Location on redirect responses
  3. If the endpoint should not redirect, fix it to return the artifact or a 4xx directly
  4. If a proxy strips Location, adjust its header forwarding config
  5. Retry after correcting the upstream; this is a server-side issue

Example fix

// before
// server responds: 302 with no Location header -> error

// after (server side, nginx)
return 302 https://github.com/owner/repo/releases/latest;
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const res = await fetchWithAllowlistedRedirects(url, signal);
} catch (err) {
  if (err instanceof Error && err.message.includes('redirectNoLocation')) {
    // retry once against the final known-good artifact URL, then surface error
  } else throw err;
}

Prevention

When it happens

Trigger: An update feed or asset endpoint returning 301/302/307/308 without a Location header — misconfigured server, a stripped header from a proxy, or a status misuse where 3xx is returned as an error signal.

Common situations: CDN or nginx misconfiguration dropping Location; load balancer health checks responding 302 with no target; server returning 304 for conditional requests when the client used manual redirect mode; object storage presigned-URL flows that 3xx without Location when the signature expired.

Related errors


AI-assisted analysis of iOfficeAI/AionUi@711aa0550e (2026-08-28). Data as JSON: /api/errors/864ac16f64b44a53. Report an issue: GitHub.