mongodb-memory-server binary download failed in CI
mongodb-memory-server downloads a real mongod binary on first use. In CI that download fails when the runner is offline, behind a proxy, or the download host is blocked, so tests cannot start the in-memory server.
What this error means
Test setup hangs or fails with "failed to download" or "Download failed for ..." from mongodb-memory-server, often on the first run before any cache exists.
Error: Status Code is 403 (MongoDB's 403 is really 404), for host ...
mongodb-memory-server: failed to download / start mongod
at MongoBinaryDownload.downloadCommon causes
The runner cannot reach the binary download host
An offline or firewalled runner cannot fetch the mongod archive, so the first-run download fails.
A proxy or wrong architecture URL
A corporate proxy is not configured, or the resolved download URL does not match the runner OS/arch.
How to fix it
Cache the downloaded binary between runs
- Set a stable cache directory via
MONGOMS_DOWNLOAD_DIR. - Cache that directory in the workflow so the binary downloads once.
- Subsequent runs reuse the cached mongod.
env:
MONGOMS_DOWNLOAD_DIR: /home/runner/.cache/mongodb-binaries
# then cache that path with actions/cache@v4Point at a reachable mirror or preinstalled system binary
Use MONGOMS_DOWNLOAD_URL for an internal mirror, or MONGOMS_SYSTEM_BINARY to reuse a mongod already on the runner.
export MONGOMS_DOWNLOAD_URL="https://mirror.internal/mongodb-linux-x86_64-7.0.0.tgz"
# or reuse an installed mongod:
export MONGOMS_SYSTEM_BINARY=/usr/bin/mongodHow to prevent it
- Cache the binaries directory so the download runs once.
- Configure a mirror URL or system binary on restricted networks.
- Pin the mongod version so the cache key is stable.