yamadashy/repomix · error · RepomixError

Failed to download GitHub archive after ${retries} attempts.

Error message

Failed to download GitHub archive after ${retries} attempts. ${lastError?.message || 'Unknown error'}

What it means

downloadGitHubArchive retries downloading the repository archive from GitHub (codeload/API endpoints) a fixed number of times; if every attempt fails it throws this error with the last attempt's error message. It indicates a persistent network, DNS, proxy, or GitHub availability problem rather than an HTTP API status error.

Source

Thrown at src/core/git/gitHubArchive.ts:101

        const isNotFoundError =
          lastError instanceof RepomixError &&
          (lastError.message.includes('not found') || lastError.message.includes('404'));
        if (isNotFoundError && archiveUrls.length > 1) {
          break;
        }

        // If it's the last attempt, don't wait
        if (attempt < retries) {
          const delay = Math.min(1000 * 2 ** (attempt - 1), 5000); // Exponential backoff, max 5s
          logger.trace(`Retrying in ${delay}ms...`);
          await new Promise((resolve) => setTimeout(resolve, delay));
        }
      }
    }
  }

  // If we get here, all attempts failed
  throw new RepomixError(
    `Failed to download GitHub archive after ${retries} attempts. ${lastError?.message || 'Unknown error'}`,
  );
};

/**
 * Downloads and extracts a tar.gz archive from a single URL using streaming pipeline.
 * The HTTP response is streamed through gunzip and tar extract directly to disk,
 * without writing a temporary archive file.
 */
const downloadAndExtractArchive = async (
  archiveUrl: string,
  targetDirectory: string,
  timeout: number,
  onProgress?: ProgressCallback,
  deps: ArchiveDownloadDeps = defaultDeps,
): Promise<void> => {
  const controller = new AbortController();
  const timeoutId = setTimeout(controller.abort.bind(controller), timeout);

View on GitHub (pinned to f465ad9093)

Solutions

  1. Check network access to github.com / codeload.github.com (curl -I https://codeload.github.com) and fix proxy/VPN/firewall settings.
  2. Retry later or check the GitHub status page — the error may be a transient GitHub-side outage.
  3. If retries are exhausted due to a slow connection, increase the timeout/retry budget or use a more reliable network, then re-run.
  4. Fall back to cloning with git directly (repomix supports local paths / git clone instead of archive download).

Example fix

// before
npx repomix --remote https://github.com/user/repo   // fails behind corporate proxy
// after
export HTTPS_PROXY=http://proxy.corp.local:8080
npx repomix --remote https://github.com/user/repo
Defensive patterns

Strategy: retry

Validate before calling

const ok = await fetch('https://codeload.github.com/owner/repo/tar.gz/HEAD', { method: 'HEAD' })
  .then(r => r.ok).catch(() => false);
if (!ok) throw new Error('GitHub unreachable from this network; fix proxy/DNS before running.');

Try / catch

try {
  await pack({ remote: url });
} catch (e) {
  if (e instanceof RepomixError && e.message.startsWith('Failed to download GitHub archive after')) {
    // transient network issue: back off and retry, or fall back to git clone
    await new Promise(r => setTimeout(r, 5000));
  } else throw e;
}

Prevention

When it happens

Trigger: All retry attempts of downloadGitHubArchive fail — repeated network timeouts, connection resets, DNS failures, or streaming pipeline errors across every attempt; lastError's message is embedded in the output.

Common situations: Corporate proxy or firewall blocking codeload.github.com; offline or flaky network; DNS not resolving; GitHub incident/ outage; TLS interception certificates breaking the fetch pipeline.

Related errors


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/b191f56f586efd79. Report an issue: GitHub.