Skip to content
Latchkey

Bazel repository rule download failed (network) in CI

A repository rule (http_archive, git_repository) could not download its artifact. Often transient network failure; sometimes a moved URL or wrong checksum.

What this error means

External setup fails with "Error downloading [url] to ...: <network error>" or a checksum mismatch, before any target is built.

bazel
ERROR: An error occurred during the fetch of repository 'rules_go':
java.io.IOException: Error downloading
[https://example.com/rules_go.tar.gz] to /root/.cache/...: Connection timed out

Common causes

Transient network failure

A timeout or reset while downloading the archive; a retry usually succeeds.

URL moved or unreachable

The artifact URL changed or the host is blocked from the runner network.

Checksum mismatch

The sha256 in the rule does not match the downloaded file, so Bazel rejects it.

How to fix it

Add retries and mirror URLs

  1. Provide multiple urls and let Bazel retry transient failures.
.bazelrc
# .bazelrc
build --experimental_repository_downloader_retries=3

Fix the URL or checksum

  1. Update the moved URL, or recompute and pin the correct sha256.
WORKSPACE
http_archive(name = "rules_go", sha256 = "<correct>", urls = ["<url>"])

How to prevent it

  • Self-healing managed runners like Latchkey auto-retry transient download failures, and a stable network plus mirror URLs keeps external fetches reliable for heavy monorepo builds.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →