How to Fix MongoDB Error 220 (FTDCPathAlreadySet)
You get mongodb error 220 when a process tries to set the diagnostic path twice. To fix it, remove duplicate diagnostic path entries from your startup scripts and restart. The official name for this failure is FTDCPathAlreadySet. FTDC stands for Full Time Diagnostic Data Capture. The database engine uses this tool to save health metrics to a local folder. Once the engine locks that folder path at startup, it rejects any second path change. What causes mongodb error 220 in your cluster This e
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 get mongodb error 220 when a process tries to set the diagnostic path twice. To fix it, remove duplicate diagnostic path entries from your startup scripts and restart.
The official name for this failure is FTDCPathAlreadySet. FTDC stands for Full Time Diagnostic Data Capture. The database engine uses this tool to save health metrics to a local folder. Once the engine locks that folder path at startup, it rejects any second path change.
What causes mongodb error 220 in your cluster
This error happens when the database receives two commands to set the diagnostic folder path. The engine initializes the diagnostic collector very early during the boot sequence. If a startup file or runtime request sets the path again, the engine throws code 220.
Automation tools are a common trigger for this specific issue. A deployment script might pass a folder path while a local file also defines one. In other cases, an admin script tries to change the diagnostic path on a running node. Because the path is already active, the database blocks the update and returns FTDCPathAlreadySet.
Cluster upgrades and node migrations can also surface this fault. When teams merge old and new startup templates, duplicate settings often slip into the final file. The database catches this conflict right away so it does not split diagnostic logs across two folders.
How to diagnose and fix FTDCPathAlreadySet safely
Start your check by reading the server log from the failed boot or rejected command. Look for the exact moment the diagnostic collector starts up and sets its directory. Next, inspect your startup files and deployment scripts for duplicate diagnostic path rules.
Keep only one diagnostic path definition in your primary startup template. Remove any runtime calls that try to alter this directory while the node is online. If you must move the diagnostic folder to a new disk, update the main startup file first. Then perform a clean rolling restart of each node in the replica set.
MongoDB Authentication & Authorization + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Protecting database roles during diagnostic checks
When engineers investigate error 220, they often ask for broad admin rights on the cluster. Giving out full admin credentials for simple log checks creates a major security risk. Instead, teams should use role-based rules that grant actions down to the collection level.
For routine checks, the built-in read role gives safe access to non-system collections. It lets engineers run find, dbStats, and collStats actions without allowing data changes. It blocks risky actions like insert, update, remove, and dropCollection on your production data.
Reserve write roles and server admin privileges for tested deployment pipelines. Also, if engineers run queries during a check, use data masking on the output. Masking rewrites matched fields like emails, phone numbers, and card numbers in query results. This keeps sensitive customer data safe while your team fixes the diagnostic path error.
Inspect MongoDB wire traffic in flight
Built-in MongoDB roles govern collection access at setup time. They cannot score command risk per call or mask sensitive document values on the fly. By design, hoop.dev sits inline in the MongoDB protocol next to your server as a sidecar for your MongoDB. On every production command from mongosh, drivers, or AI agents, hoop.dev decides whether to pass, mask, block, or hold it for human review.
First, hoop.dev guardrails block bad deletes, drops, and write pipelines or hold them for approval. Next, hoop.dev data masking rewrites sensitive values in returned documents in memory and logs each decision. Explore the repo on GitHub.
Frequently asked questions
What does FTDCPathAlreadySet mean in MongoDB?
FTDCPathAlreadySet is the official name for error code 220 in the database engine. It means the folder path for Full Time Diagnostic Data Capture is already set. The engine will not allow a second path assignment while the collector is active.
Can I change the diagnostic path without restarting the node?
No, the database locks the diagnostic directory path when the process starts up. Trying to set a new path on a running node triggers error 220. You must update your startup file and restart the process to use a new folder.
Does fixing error 220 require the readWrite role?
No, database roles like read and readWrite only control access to data inside collections. Fixing a startup path conflict requires editing the host startup file and restarting the service. For database health checks afterward, a basic read role is enough to view collection stats.
Related guides
In this post