Skip to content
Latchkey

MongoDB Atlas "cluster not found" (CLI / API) in CI

Atlas could not find a cluster with the given name in the given project. Either the cluster name is misspelled, or the request used the wrong project (group) id, so the resource lookup fails.

What this error means

An atlas clusters describe <name> or an API call returns "CLUSTER_NOT_FOUND" / "No cluster named ... exists", even though the cluster is visible in the Atlas UI.

bash
Error: https://cloud.mongodb.com/api/atlas/v2/groups/<id>/clusters/prod0:
404 (request "CLUSTER_NOT_FOUND") No cluster named prod0 exists in group <id>.

Common causes

Wrong project (group) id

The cluster exists, but under a different project than the --projectId/group id used, so the scoped lookup returns not found.

A misspelled cluster name

Cluster names are exact; a typo or wrong case yields CLUSTER_NOT_FOUND.

How to fix it

Confirm the project id and cluster name

  1. List projects to get the correct group id.
  2. List clusters in that project to get the exact name.
  3. Use those exact values in the CI step.
Terminal
atlas projects list
atlas clusters list --projectId "$ATLAS_PROJECT_ID"

Pass the project id explicitly

Set the project id from a secret so the CLI targets the right project every run.

Terminal
atlas clusters describe prod0 --projectId "$ATLAS_PROJECT_ID"

How to prevent it

  • Pin the project id as a CI secret and pass it explicitly.
  • List clusters to copy the exact name rather than guessing.
  • Fail fast if the cluster lookup returns not found.

Related guides

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