Bazel ".bazelversion" / Bazelisk version not found in CI
Bazelisk reads .bazelversion to pick which Bazel to download. When that version string does not correspond to a real release (a typo or a yanked version), Bazelisk cannot fetch a binary and the build never starts.
What this error means
A build fails before any target with a Bazelisk error that it could not download the requested Bazel version, often a 404 for the release artifact named in .bazelversion.
could not download Bazel: HTTP GET https://releases.bazel.build/7.9.9/release/...
returned status code 404Common causes
The pinned version does not exist
The string in .bazelversion (for example 7.9.9) is not a published release, so Bazelisk gets a 404 fetching it.
A typo or malformed version line
Trailing whitespace, a stray prefix, or a non-version value in .bazelversion makes Bazelisk request a nonexistent artifact.
How to fix it
Pin a real, published version
- Set
.bazelversionto an actual Bazel release (just the version number, no extra characters). - Commit the corrected file.
- Re-run so Bazelisk downloads the matching binary.
7.4.1Cache the Bazelisk download
Persist the Bazelisk cache so a previously downloaded version is reused and not refetched each run.
- uses: actions/cache@v4
with:
path: ~/.cache/bazelisk
key: bazelisk-${{ hashFiles('.bazelversion') }}How to prevent it
- Keep
.bazelversionset to a published release with no stray characters. - Bump it deliberately and verify the version exists.
- Cache the Bazelisk download directory between runs.