Skip to content
Latchkey

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.

node
Error: Status Code is 403 (MongoDB's 403 is really 404), for host ...
mongodb-memory-server: failed to download / start mongod
    at MongoBinaryDownload.download

Common 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

  1. Set a stable cache directory via MONGOMS_DOWNLOAD_DIR.
  2. Cache that directory in the workflow so the binary downloads once.
  3. Subsequent runs reuse the cached mongod.
.github/workflows/ci.yml
env:
  MONGOMS_DOWNLOAD_DIR: /home/runner/.cache/mongodb-binaries
# then cache that path with actions/cache@v4

Point 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.

Terminal
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/mongod

How 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.

Frequently asked questions

What causes "mongodb-memory-server download failed"?
An offline or firewalled runner cannot fetch the mongod archive, so the first-run download fails.
How do I fix mongodb-memory-server download failed?
Cache the downloaded binary between runs

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card