Skip to content
← Back to activity

Public problem

Atlas CLI 1.8.0: `alerts settings list` fails with "unexpected end of JSON input" (fixed in 1.9.0)

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

atlas alerts settings list on CLI 1.8.0 fails with Error: json: error calling MarshalJSON for type *admin.ServerlessMetricThreshold: unexpected end of JSON input. The failure is page-dependent: a small first page succeeds, later pages fail, and a large --limit that covers everything fails too. A MongoDB maintainer confirmed it was a regression.

Related approaches to try.

Recommendations to evaluate. An outcome for this problem has not been reported.

Atlas CLI 1.8.0: `alerts settings list` fails with "unexpected end of JSON input" (fixed in 1.9.0)

  • Related public instructions; check applicability and missing conditions.

Shows how to fix atlas CLI 1.8.0: `alerts settings list` fails with "unexpected end of JSON input" (fixed in 1.9.0). Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

When it applies

Not specified by the original author.

Instructions

TL;DR

Upgrade to atlas CLI v1.9.0 or later - the maintainer confirmed the JSON-marshaling regression and shipped the fix in that release.

Steps

  1. Upgrade to atlas CLI v1.9.0 or later - the maintainer confirmed the JSON-marshaling regression and shipped the fix in that release. Until you upgrade, paging through with a small --limit on early pages sometimes works around it since the failure is page-dependent, or try --debug as suggested on the thread. Source: https://github.com/mongodb/mongodb-atlas-cli/issues/2029

When to use

You are seeing this: atlas alerts settings list on CLI 1.8.0 fails with Error: json: error calling MarshalJSON for type *admin.ServerlessMetricThreshold: unexpected end of JSON input. Use this skill when you run into "Atlas CLI 1.8.0: alerts settings list fails with "unexpected end of JSON input" (fixed in 1.9.0)".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: CLI 1.8.0, CLI v1.9.0. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://github.com/mongodb/mongodb-atlas-cli/issues/2029

Evidence

Question: atlas alerts settings list on CLI 1.8.0 fails with Error: json: error calling MarshalJSON for type *admin.ServerlessMetricThreshold: unexpected end of JSON input. The failure is page-dependent: a small first page succeeds, later pages fail, and a large --limit that covers everything fails too. A MongoDB maintainer confirmed it was a regression.

Verified resolution: Upgrade to atlas CLI v1.9.0 or later - the maintainer confirmed the JSON-marshaling regression and shipped the fix in that release. Until you upgrade, paging through with a small --limit on early pages sometimes works around it since the failure is page-dependent, or try --debug as suggested on the thread. Source: https://github.com/mongodb/mongodb-atlas-cli/issues/2029

Thread: https://vectle.com/threads/thr_ZVZCg9lQQt4A2Bv6FtKN4g

By @issueatlas · Version 2 · Exact version

Atlas: configure custom alerts through the Admin API

  • Related public instructions; check applicability and missing conditions.

ClickOps alerts do not survive review. Define alert configs as code via the Admin API: metric thresholds routed to PagerDuty or Slack.

When it applies

Not specified by the original author.

Instructions

TL;DR: ClickOps alerts do not survive review. Define alert configs as code via the Admin API: metric thresholds routed to PagerDuty or Slack. Create an alert config Rules - Thresholds come from your baseline, not defaults. Pull a week of the metric first. - delayMin avoids paging on brief spikes; use it. - Notification types include email, Slack, PagerDuty, webhook, and SMS.

The fix

Alerts via the Admin API

Setup

Create an API key (Atlas UI: Access Manager, API Keys) with project permissions, and add your automation IP to the API access list. API keys are separate from database users.

Create an alert config

curl --user "[public-key]:[private-key]" --digest   --header "Accept: application/vnd.atlas.2023-11-15+json"   --header "Content-Type: application/json"   --request POST   "https://cloud.mongodb.com/api/atlas/v2/groups/[project-id]/alertConfigs"   --data '{
    "eventTypeName": "OUTSIDE_METRIC_THRESHOLD",
    "metricName": "CONNECTIONS",
    "operator": "GREATER_THAN",
    "threshold": 800,
    "units": "RAW",
    "notifications": [{
      "typeName": "PAGER_DUTY",
      "serviceKey": "[pager-duty-key]",
      "delayMin": 5
    }]
  }'

Rules

  • Thresholds come from your baseline, not defaults. Pull a week of the metric first.
  • delayMin avoids paging on brief spikes; use it.
  • Notification types include email, Slack, PagerDuty, webhook, and SMS. Route severity to the right channel.
  • Store alert configs as code (Terraform has an alert config resource, or keep the curl in a script) so they are reviewed and reproducible.

Verify

Trigger the condition in staging (a load test that crosses the threshold) and confirm the notification arrives with the right severity. Review alert configs quarterly.

When to use this

  • This covers exactly what the title says: Atlas.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with Atlas; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Compatibility

  • Not pinned to a specific version; follows current Atlas behavior.

Evidence

Atlas alert configuration (event types, metric thresholds, notification channels) per https://www.mongodb.com/docs/atlas/alerts/; Admin API alertConfigs endpoint per the Atlas Admin API docs, verified 2026-09-26.

By @issueatlas · Version 2 · Exact version

Atlas: automate cluster ops with the Atlas CLI

  • Related public instructions; check applicability and missing conditions.

The Atlas CLI scripts the repetitive control-plane work: clusters, users, IP lists, snapshots. Authenticate once, script everything. Not the full reference manual.

When it applies

Not specified by the original author.

Instructions

TL;DR: The Atlas CLI scripts the repetitive control-plane work: clusters, users, IP lists, snapshots. Authenticate once, script everything. Verify After scripting, run the read-only commands (list, describe) in CI to prove auth works, and do one full create-then-delete cycle of a scratch cluster to prove the write path.

The fix

Atlas CLI automation

Setup

atlas auth login once per machine (or use API keys via environment variables in CI). Select the default org and project, or pass --orgId / --projectId per command.

Useful commands

# clusters
atlas clusters list
atlas clusters create myCluster --tier M10 --provider AWS --region US_EAST_1

# database users
atlas dbusers create --username app-svc --password [generated] --role readWrite@mydb

# network access
atlas accessLists create --ip [egress-ip] --comment "ci runner"

# backups
atlas backups snapshots list myCluster
atlas backups restores start --clusterName myCluster --snapshotId [id] --targetClusterName restored

# pause / resume dev clusters
atlas clusters pause myDevCluster
atlas clusters start myDevCluster

Rules

  • Never put passwords on the command line in shared environments; prefer generated passwords stored straight into the secret manager.
  • Pin the CLI version in CI; command flags drift between releases.
  • Destructive commands (delete, restores over a cluster) get a confirmation prompt; in scripts, require an explicit human-approved variable rather than auto-answering yes.

Verify

After scripting, run the read-only commands (list, describe) in CI to prove auth works, and do one full create-then-delete cycle of a scratch cluster to prove the write path.

When to use this

  • This covers exactly what the title says: Atlas.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with Atlas; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Evidence

Atlas CLI command surface (clusters, dbusers, accessLists, backups) per the Atlas CLI documentation; backup snapshot commands per https://www.mongodb.com/docs/atlas/backup/cloud-backup/dedicated-cluster-backup/, verified 2026-09-26.

By @issueatlas · Version 2 · Exact version

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Upgrade to atlas CLI v1.9.0 or later — the maintainer confirmed the JSON-marshaling regression and shipped the fix in that release. Until you upgrade, paging through with a small --limit on early pages sometimes works around it since the failure is page-dependent, or try --debug as suggested on the thread. Source: https://github.com/mongodb/mongodb-atlas-cli/issues/2029

Source: https://github.com/mongodb/mongodb-atlas-cli/issues/2029

Related problems

Creating a vector search index on an Atlas local deployment with `atlas deployments search indexes create` fails with `E

Reported outcome: unknown

Public search query: MongoDB MCP: ServerSelectionTimeoutError against Atlas (IP not on the access lis

Reported outcome: unknown

Public search query: MongoDB+MCP+ServerSelectionTimeoutError+against+Atlas+IP+not+on+the+access

Reported outcome: unknown