Errors and exceptions

Updated at:

Learn about common error messages and exceptions in ApsaraDB for MongoDB, their causes, and how to resolve them.

Error message

Cause and solution

Specified parameter AccountDescription is not valid.

When you restore backup data to a new instance, ensure that the name of the new instance meets the specified requirements.

Shard total number is out of range.

When you restore a sharded cluster to a new instance, ensure that the new instance has the same number of shards as the source instance.

  • Downgrading instance storage is not supported.

  • Downgrading the disk space for an instance is not supported.

ApsaraDB for MongoDB does not support decreasing the storage of an instance. If you need to reduce storage, you can create a new instance to replace the original one. For instructions, see Other configuration change scenarios and solutions.

The classic network is no longer supported. We recommend using a VPC instead.

Operations such as instance renewal, instance type changes, and billing method changes are no longer supported for ApsaraDB for MongoDB instances that use the classic network. For more information, see [Notice] Retirement of the classic network for ApsaraDB for MongoDB.

There are insufficient resources for your operation.

The target zone has insufficient resources for the requested configuration change. Try changing to a different instance type or submit a ticket to contact technical support for assistance.

This operation is not permitted for this instance type.

If you encounter this error when you reset a password, check the instance type. Serverless instances do not support password resets. To change the password for a Serverless instance, submit a ticket to contact technical support for assistance.

The oplog for the source database is not enabled.

If a data migration task fails, check the instance type. Standalone instances do not have an oplog and therefore do not support incremental migration by using Data Transmission Service (DTS). Configure a full migration instead.

The request references an incorrect order sales component. Contact customer support.

Resource availability varies by zone, and this error can occur during instance purchase. Try changing the zone or instance type, or submit a ticket to contact technical support for assistance.

The request was denied due to user flow control.

Alibaba Cloud limits the rate of API calls. You can view your current quotas in the Quota Center and request a quota increase if needed.

The database configuration lacks read privileges.

When you use Data Transmission Service (DTS) to migrate data, the source and destination database accounts must have the required permissions. For details, see:

Specified restore time is not valid.

When you use an API call to restore an instance, ensure that the specified restore time is valid. The time must be in yyyy-MM-ddTHH:mm:ssZ format and specified in UTC. For example, to convert 20:00:00 on 2024-11-08 Beijing time to UTC, you must subtract 8 hours. The corresponding UTC value is "2024-11-08T12:00:00Z".

server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field.

Authentication can fail during a cross-version restore if the authentication mechanisms are incompatible. The default mechanism for MongoDB 4.0 is SCRAM-SHA-1, while for MongoDB 5.0 and later, it is SCRAM-SHA-256. We recommend that you use an earlier version of the mongorestore tool, such as version 4.0, when you perform a cross-version restore.

TypeError: db.xxx.find is not a function.

The collection name might conflict with a reserved keyword. To resolve this, use the db.getCollection("xxx").find method to query the collection, or rename the collection.

createUser failed: Command failed with error xx (Unauthorized): 'not authorized on admin to execute command xxx.

For security and performance reasons, Alibaba Cloud accounts are restricted and no longer support creating users with write permissions on the admin system database. This prevents potential performance issues caused by writes to the admin database. For more information about creating users with appropriate permissions, see What are the permissions of the root account specified during instance creation?

The specified network type does not match.

You cannot add a VPC security group to an instance that already has a classic network security group.

This API does not support the instance's minor version.

The minor version of the instance is too old for this API operation. Upgrade the minor version of the database.

The instance version is in the End of Full Support (EOFS) stage.

The instance version has reached the End of Full Support (EOFS) stage and cannot be renewed. Upgrade the major version of the database.

The resource is exhausted.

A resource issue occurred during instance creation or a configuration change. Obtain the Request ID and then submit a ticket to contact technical support for assistance.

InvalidStartTime.Malformed

When you call API operations such as DescribeDBInstancePerformance, the StartTime and EndTime parameters must be in UTC using the yyyy-MM-ddTHH:mmZ format. This error occurs if you pass a local time value such as Beijing time. Convert the time to UTC by subtracting 8 hours. For example, convert 2024-01-15 16:00:00 Beijing time to 2024-01-15T08:00Z. This error may appear intermittent because a Beijing time of 16:00 or later falls on the next day in UTC, which can render the time range invalid.

Connection and network errors

Error message

Cause and solution

network error while attempting to run command 'isMaster' on host 'dds-xxxx.mongodb.rds.aliyuncs.com:3717' :exception: connect failed

  • Timed out after 3000ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. exception=(com.mongodb.MongoSocketReadException: Prematurely reached end of stream)

  • Socket recv() errno:54 Connection reset by peer x.x.x.x:27017

The instance may have reached its connection limit.

Solution:

  1. Check whether connections are exhausted. How do I query the number of connections?.

  2. Optimize connection usage. What do I do if the number of connections to my instance reaches its limit?.

MongoDB.Driver.MongoWaitQueueFullException: The wait queue for acquiring a connection to server xxx is full.

The MongoDB driver wait queue is full, likely due to an undersized connection pool or high concurrency.

Solution:

  1. Check the connection pool configuration in the application. Ensure the pool is appropriately sized. How do I limit the number of client connections?.

  2. If the issue persists, check whether connections to the ApsaraDB for MongoDB instance are exhausted:

    1. How do I query the number of connections?

    2. What do I do if the number of connections to my instance reaches its limit?

(TooManyLogicalSessions) Unable to add session into the cache because the number of active sessions is too high.

Excessive concurrent connections can exhaust available sessions.

Solution:

  1. Troubleshoot the connection failure that is caused by exhausted connections.

    1. How do I query the number of connections?

    2. What do I do if the number of connections to my instance reaches its limit?

  2. If the number of connections is normal, check whether other performance metrics of the instance meet your business requirements.

    1. Use node monitoring to check resource usage, such as CPU and memory, to determine if the instance type meets your business requirements.

    2. If the instance type is too small for the workload, change the instance configuration during off-peak hours.

  • getaddrinfo failed.

  • No suitable servers found (`serverSelectionTryOnce` set).

Verify that the instance endpoint is correct:

  • Failed to connect to 10.*.*.8:3717 after 5000 milliseconds, giving up.Error: couldn't connect to server 10.*.*.8:3717 (10.*.*.8), connection attempt failed

  • pymongo.errors.ServerSelectionTimeoutError: dds-xxxx.mongodb.rds.aliyuncs.com:3717: [Errno 113] No route to host,dds-xxxx.mongodb.rds.aliyuncs.com:3717

  • InvalidInstanceId.NotFound: The instance not in current vpc.

An ECS instance fails to connect to an ApsaraDB for MongoDB instance over a private network.

Solution:

  1. Check the whitelist settings. Make sure that the private IP address of the ECS instance is added to the whitelist of the ApsaraDB for MongoDB instance.

  2. Make sure that the ECS instance and the ApsaraDB for MongoDB instance can communicate with each other over the network.

    ECS and ApsaraDB for MongoDB instances in the same VPC can connect directly over the private network. If they are in different VPCs, use one of the following methods:

org.springframework.data.mongodb.UncategorizedMongoDbException: Timeout while receiving message; nested exception is com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message

  • "errmsg": "not master", "code": 10107, "codeName": "NotMaster"

  • "errmsg": "not master", "code": 10107, "codeName": "NotWritablePrimary"

  • Time out after 30000ms while waiting for a server that matches writableServerSelector.

  • Command failed with error 10107 (NotWritablePrimary): 'not primary' on server xxx.

  • Explain's child command cannot run on this node. Are you explaining a write command on a secondary?

  • not master and slaveOk=false.

  • MongoNotPrimaryException: Command failed with error 10107 (NotMaster): 'not master' on server xxx.

  • reason: TopologyDescription { type: 'ReplicaSetNoPrimary',...}

The node to which data is being written is not a primary node.

Cause: Write operations can be performed only on the primary node. If your application was previously connected by using the endpoint of the primary node, a failover can change the connected node to a secondary node, which causes write operations to fail.

Solution:

  • For production environments, we recommend that your application connects to the database by using a ConnectionString URI. This way, if a node fails, read and write operations are unaffected by failover. For endpoint details, see the following topics:

  • Manually switch node roles. Promote the node that corresponds to the single-node endpoint to the primary node.

Implement reconnection logic and exception handling in your application to recover automatically from transient disconnections.

[Unauthorized] cloud instance error, disk locked, plz check and upgrade your disk quota,

Exhausted disk space has locked the instance.

Solution: Resolve instance locking or write failures caused by exhausted disk space.

(AuthenticationFailed) Authentication failed.

  • !xxx@dds-xxx.mongodb.rds.aliyuncs.com: event not found

The password of the database account contains special characters, such as !@#$%^&*()_+=.

Solution: How do I resolve a connection failure that is caused by special characters in a username or password?.

error getting cluster ID: (CommandNotFound) replSetGetConfig is forbidden by cloud provider for security reason

ApsaraDB for MongoDB does not support replSetGetConfig. Limits on commands in ApsaraDB for MongoDB.

Errors when upgrading from version 4.2 to 4.4

Error message

Cause and solution

CHECK_USER_COLLECTIONS_IN_ADMIN_FAILED

Cause: The admin database contains user-created collections. For security reasons, accounts no longer have write permissions on the admin database in MongoDB 4.4 and later. Therefore, you must move any custom collections to another database.

Solution:

  1. Run the following command to move the old_collection collection to the new_collection collection in the new_db database. The old and new collection names can be the same.

    db.getSiblingDB("admin").runCommand({renameCollection: "<admin.old_collection>", to: "<new_db.new_collection>"})
    Important

    If the collection is large, this command may take a long time to run. During this process, all write operations to the collection are blocked. We recommend that you schedule a sufficient maintenance window for the migration.

  2. After the rename operation is complete, run the drop operation to delete the original collection. You can then proceed with the upgrade to version 4.4.

    db.getSiblingDB("admin").getCollection("<old_collection>").drop()

CHECK_USERS_AND_ROLES_FAILED

Cause: The admin database contains custom accounts (users) with high-privilege roles. For security reasons, root and custom accounts no longer have write permissions on the admin database in MongoDB 4.4 and later. You must revoke the write permissions on the admin database from these custom accounts.

Solution: The account and role that require modification are shown in the error message in the console: "user my_user has high privilege role readWrite". You can run the following command to revoke the readWrite role on the admin database from the my_user account.

Important

Before you run this command, ensure that your application does not use this account to perform write operations on the admin database.

db.getSiblingDB("admin").runCommand({revokeRolesFromUser: "my_user", roles: [{role: "readWrite", db: "admin"}]})