Skip to content
Latchkey

MongoDB "atlas: command not found" (Atlas CLI) in CI

The Atlas CLI (atlas) is a separate tool from mongosh and the driver, and it is not preinstalled on GitHub runners. Any atlas ... step fails until it is installed and authenticated with API keys.

What this error means

A step calling atlas clusters list or atlas accessLists create fails with "atlas: command not found" and exit code 127.

bash
/home/runner/work/_temp/script.sh: line 1: atlas: command not found
Error: Process completed with exit code 127.

Common causes

The Atlas CLI is not installed

Runners ship mongosh at most; the atlas binary must be installed explicitly before use.

Confusing atlas with mongosh

The Atlas CLI manages cloud resources (clusters, access lists, API keys) and is distinct from the mongosh data shell.

How to fix it

Install the Atlas CLI, then authenticate with API keys

  1. Install the Atlas CLI from the MongoDB apt repo or the release archive.
  2. Set ATLAS_PUBLIC_KEY and ATLAS_PRIVATE_KEY (and project id) as secrets.
  3. Run atlas commands non-interactively.
Terminal
curl -sL https://fastdl.mongodb.org/mongocli/mongodb-atlas-cli_1.30.0_linux_x86_64.tar.gz | tar xz
sudo mv atlascli_*/bin/atlas /usr/local/bin/atlas
export MONGODB_ATLAS_PUBLIC_API_KEY="$ATLAS_PUBLIC_KEY"
export MONGODB_ATLAS_PRIVATE_API_KEY="$ATLAS_PRIVATE_KEY"

Verify the CLI is authenticated

Confirm the API keys work before running resource commands.

Terminal
atlas projects list

How to prevent it

  • Install the Atlas CLI as an explicit setup step.
  • Provide API keys via environment variables from secrets.
  • Keep the CLI version pinned for reproducibility.

Frequently asked questions

What causes ""atlas: command not found""?
Runners ship mongosh at most; the atlas binary must be installed explicitly before use.
How do I fix "atlas: command not found"?
Install the Atlas CLI, then authenticate with API keys

Related guides

References

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