How to Fix MongoDB Error 300 (RangeDeletionAbandonedBecauseCollectionWithUUIDDoesNotExist)
You see mongodb error 300 when a shard tries to clean up a deleted collection. To fix it, check your drop logs and let the cluster finish its background cleanup. The official name for this issue is RangeDeletionAbandonedBecauseCollectionWithUUIDDoesNotExist. It happens in sharded clusters during chunk moves and collection drops. The database engine stops the range deletion task because the target collection is gone. In most cases, the cluster handles this state on its own without data loss. W
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You see mongodb error 300 when a shard tries to clean up a deleted collection. To fix it, check your drop logs and let the cluster finish its background cleanup.
The official name for this issue is RangeDeletionAbandonedBecauseCollectionWithUUIDDoesNotExist. It happens in sharded clusters during chunk moves and collection drops. The database engine stops the range deletion task because the target collection is gone. In most cases, the cluster handles this state on its own without data loss.
What causes mongodb error 300 in sharded clusters
Sharded clusters move data chunks between shards to keep the load balanced. When a chunk moves, the source shard must delete the old data range later. The database queues this range deletion as a background task.
Sometimes, a user or an app drops the collection before that cleanup task runs. Each collection in the database has a unique ID. When the cleanup worker starts, it looks for that specific ID on the shard.
If the collection is already gone, the worker cannot find the unique ID. The engine then logs mongodb error 300 and abandons the range deletion task. It also happens if a collection is dropped and built again with the same name. The new collection gets a fresh ID, so the old range task fails.
Overly broad user permissions often trigger this issue in busy clusters. In this database, roles grant actions on resources down to the collection level. The standard read and write role includes the action to drop a collection. If an app or script has this role, it might drop collections during chunk moves.
How to diagnose and fix the failure safely
Start your check by reading the database server logs on the affected shard. Look for the missing collection ID noted in the error message. Match that ID with recent collection drop events in your audit logs.
MongoDB Authentication & Authorization + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
You do not need to grant full admin rights to check cluster state. Use a built-in read role to check collection stats and list current collections. The read role lets you run find and stats actions without risk to live data. It does not allow anyone to drop collections or change data during your check.
Once you confirm the collection was dropped on purpose, the fix is simple. Let the database abandon the orphaned range task and clear its internal queue. Do not turn off balancer safety checks or edit system metadata tables by hand. Modifying internal routing tables directly can corrupt your sharded cluster.
How to prevent unplanned collection drops
You can stop this error from coming back by tightening your role setup. Review which users and apps hold the read and write role in production. Remember that this role allows users to drop collections and indexes.
Move human users and reporting tools to the basic read role instead. If a developer needs to inspect production data, protect sensitive fields during the query. Data masking rewrites matched fields like emails, phone numbers, card numbers, and national IDs in results.
Schedule heavy schema changes and collection drops during low traffic windows. Check that no chunk migrations are active for a collection before you drop it. This simple check keeps the range deletion queue clean and avoids error logs.
Add command guardrails and field masking beside MongoDB
Collection roles and IP rules control who connects to MongoDB. Yet an active client or agent session can still run a pipeline that writes data or reads raw personal fields. In practice, hoop.dev sits inline in the wire protocol beside your database as a sidecar for your MongoDB. For every command an agent or human sends in production, hoop.dev decides to pass, mask, block, or escalate it for review.
Using hoop.dev MongoDB controls, guardrails refuse banned commands before they run or hold risky calls for approval, and data masking rewrites matched fields in returned documents in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for GDPR, HIPAA, and PCI DSS programs. View the project on GitHub.
Frequently asked questions
Does mongodb error 300 cause data loss in my cluster?
No, this error does not cause data loss. It means the database skipped cleaning up a data range because the whole collection was already deleted.
Should I restart my shard servers to clear this error?
No, you do not need to restart your shard servers. The storage engine abandons the obsolete task on its own and continues normal work.
How can I stop apps from triggering range deletion errors?
Remove collection drop permissions from everyday app roles and run schema drops only when the cluster balancer is idle.
Related guides
In this post