All Products
Search
Document Center

ApsaraDB for MongoDB:Troubleshooting

Last Updated:Apr 11, 2025

This topic describes the common errors and exceptions that you may encounter in the use of ApsaraDB for MongoDB. This topic also provides the solutions of the errors and exceptions.

Error message

Cause and solution

Specified parameter AccountDescription is not valid.

When you restore backup data to another instance, check whether the instance name meets the specified limits.

Shard total number is out of range.

When you restore data from the sharded cluster instance to a new sharded cluster instance, check whether the new instance has the same number of shards as that of the original instance.

The downgrading dbinstance storage does not supported.

ApsaraDB for MongoDB does not allow you to reduce the storage capacity of your instance. To reduce the storage capacity of the instance, you can create an instance and restore data from the original instance to the created instance. For more information, see Other configuration change scenarios and methods.

Classic network has not been supported, try to use VPC.

You cannot renew all ApsaraDB for MongoDB instances in the classic network, change their specifications, or change their billing methods. For more information, see [Notice] EOL for instances in the classic network.

There is not enough resource for your operation.

The zone of the instance has insufficient resources when you upgrade the instance. You can change the existing instance specification to another specification or submit a ticket.

Operation logging is not enabled for the source database.

If you cannot configure a data migration task, check the instance architecture. Standalone instances do not support the opration logging feature and allow you to use Data Transmission Service (DTS) for incremental migration. We recommend that you set the migration mode to full migration.

The Request references an incorrect order sales component. Contact the customer support.

When you purchase the instance, the available resources vary based on the zone of the instance. You can change the zone or instance specification, or submit a ticket.

User Request was denied due to user flow control.

To manage access to APIs, Alibaba Cloud imposes limits on the calling frequency of the APIs. You can view calling frequency quotas in the Quota Center console.

database config lack of read privileges.

If you use DTS to migrate data between instances, the accounts of the source and destination databases must have the corresponding permissions. For more information about the permissions and authorization methods, see the following topics:

Specified restore time is not valid.

When you call an API to restore the instance, check whether the restoration time is valid. The time must be in the yyyy-MM-ddTHH:mm:ssZ format. The time must be displayed in UTC. For example, the local time in Beijing is 20:00:00 on November 8, 2024. You must subtract 8 hours to convert the time to a UTC timestamp. The UTC timestamp is 2024-11-08T12:00:00Z.

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

When you recover the instance across versions, authentication fails if the authentication mechanism is different among the versions. The default authentication mechanism of MongoDB 4.0 is SCRAM-SHA-251. The default authentication mechanism of MongoDB 5.0 and later is SCRAM-SHA-256.

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

The collection name may contain keywords. We recommend that you use db.getCollection("xxx").find for a query or modify the existing collection name.

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

The permissions of the current Alibaba Cloud account are limited. You cannot create an account that has write permissions on the admin system database. This prevents performance jitter that may occur when you write data to the admin database. For more information about how to create an account that has the required permissions, see Permissions of the alibabaCloudAdmin role

Specified network type does not matched.

If you have added a classic security group to your instance, you cannot add dedicated security groups at the same time.

Instance's MinorVersion is not supported for this API.

The minor version of your instance is earlier. We recommend that you update the minor version of the instance.

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

Your instance is at the End of Full Support (EOFS) stage and cannot be renewed. We recommend that you upgrade the major version of the instance.

The resource is out of usage.

This error message indicates that resources are abnormal when you create an instance or change the configurations of the current instance. We recommend that you obtain a request ID and Submit a ticket.

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 number of connections to the ApsaraDB for MongoDB instance may have reached the upper limit, and no new connections can be established.

Solution:

  1. Check whether the instance connections are exhausted. For more information, see How do I query the number of connections to my instance?

  2. Optimize connection usage. For more information, see What do I do if the number of connections to my instance reaches the upper limit?

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

The wait queue of the MongoDB driver is full, which may be caused by a small number of connections specified for a connection pool or high concurrent requests. Therefore, no available connections are provided.

Solution:

  1. We recommend that you first check the connection pool settings of the program for which this error is reported. For example, make sure that a reasonable number of connections is specified for a connection pool. For more information, see How do I limit the number of connections from my client?

  2. If this issue persists after you adjust the program, check whether the ApsaraDB for MongoDB instance has exhausted its connections. For more information, see the following topics:

    1. How do I query the number of connections to my instance?

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

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

When an excessive number of concurrent connections are established, available sessions may be exhausted.

Solution:

  1. Troubleshoot failed connection issues caused by exhausted connections. For more information, see the following topics:

    1. How do I query the number of connections to my instance?

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

  2. If no issues occur in the terms of the number of connections, check whether other instance performance items cannot meet business requirements.

    1. Use the node monitoring feature to check the usage of common resources (such as CPU utilization and memory usage) and then determine whether the instance specifications meet business requirements.

    2. If the instance specifications are excessively small but the load is high, you can change the instance configurations during off-peak hours.

  • getaddrinfo failed.

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

Check whether the used instance endpoint is correct. For more information about instance endpoints, see the following topics:

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

The ECS instance fails to connect to the ApsaraDB for MongoDB instance over a private network.

Solution:

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

  2. Ensure network connectivity between the ECS instance and the ApsaraDB for MongoDB instance.

    If the ECS instance and the ApsaraDB for MongoDB instance are in the same VPC, the two instances can directly interconnect over a private network. To connect the ECS instance to the ApsaraDB for MongoDB instance across VPCs, you can 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',...}

Data is not written to the primary node in the replica set instance.

Cause: You can perform write operations only on the primary node. If you previously used the endpoint of the primary node for connection, the connected node becomes a secondary node and write operations fail after a primary/secondary switchover.

Solution:

  • If your application runs in a production environment, we recommend that you use a connection string URI to connect your application to the instance. When a node fails, read/write operations on your application are not affected by a primary/secondary switchover. For more information about instance endpoints, see the following topics:

  • Manually switch the role of a node. Switch the node whose endpoint is used for connection to the new primary node.

We recommend that you ensure that your application can automatically reconnect to an ApsaraDB for MongoDB instance after it is disconnected and handle exceptions to protect business continuity.

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

The ApsaraDB for MongoDB instance is locked due to exhausted disk space.

Solution: For more information, see What do I do if my instance is locked or data cannot be written to the instance due to exhausted disk space?

(AuthenticationFailed) Authentication failed.

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

The password of the provided database account contains special characters. Special characters include ! @ # $ % ^ & * ( ) _ + =

Solution: For more information, see How do I resolve failed connection issues due to special characters in the account name or password in a connection string?

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

ApsaraDB for MongoDB does not support the replSetGetConfig command. For more information, see What commands are supported and not supported by ApsaraDB for MongoDB?