How to Fix MongoDB Error 180 (BadPerfCounterPath)
You see mongodb error 180 when the database engine hits a BadPerfCounterPath failure. To fix this issue, you must repair or update the broken performance counter path. MongoDB maps internal code 180 to the official BadPerfCounterPath error name. This failure stops the system from reading host performance metrics from the operating system. Database admins often see this alert during server startup or health checks. When the path fails, your metric tools lose visibility into host resource use.
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 180 when the database engine hits a BadPerfCounterPath failure. To fix this issue, you must repair or update the broken performance counter path.
MongoDB maps internal code 180 to the official BadPerfCounterPath error name. This failure stops the system from reading host performance metrics from the operating system. Database admins often see this alert during server startup or health checks. When the path fails, your metric tools lose visibility into host resource use.
What causes mongodb error 180 in production
The database server reads operating system counters to track CPU, memory, and disk work. When the host system has a missing or damaged counter path, the check fails. The engine then logs the BadPerfCounterPath code and skips that metric collection.
Host updates or broken system files often trigger this specific path failure. Sometimes a monitoring agent asks for a counter name that does not exist. Other times, a host language change shifts how the system names its local counters. In container setups, missing host mounts can also block the path to system metrics. None of these causes corrupt your stored data, but they hide vital health signals.
How to diagnose and fix the failure safely
Start your check by reading the database server log files for code 180. The log message around the BadPerfCounterPath alert shows when the read failed. Check if the error happens at startup or during periodic status checks.
Next, inspect the host operating system where the database process runs. Verify that the system performance counter service is active and has valid registry paths. If the host counters are corrupt, use the operating system tools to rebuild them. After you rebuild the host counters, restart the metric collection process to test it.
MongoDB Authentication & Authorization + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Keep database access tight while your team investigates the broken counter path. Do not give engineers full admin rights just to check server status logs. MongoDB grants access through role-based rules that apply to a specific database. A role can grant access down to the collection level. For simple data checks during an incident, use the built-in read role. The read role allows actions like find, listCollections, listIndexes, dbStats, and collStats. It blocks actions that change data, such as insert, update, remove, or dropCollection.
Preventing metric path errors across your fleet
Standard host images help you avoid broken counter paths across all database nodes. Test every operating system patch in a staging lab before you update production servers. Make sure your metric agents match the exact operating system type and locale.
Review your database roles on a regular schedule to keep debug access safe. Note that MongoDB Atlas users have different built-in roles than self-hosted users. Both deployment types build their roles from the same set of privilege actions. Give your on-call team only the read privileges they need to verify cluster health. Also use data masking to rewrite emails, phone numbers, card numbers, and national IDs in query results.
Check MongoDB commands and documents on the wire
MongoDB roles and SCRAM login decide who opens a session. They do not check single commands or redact sensitive fields inside returned documents. With hoop.dev, you run an open-source proxy, a sidecar for your MongoDB, inline in the MongoDB wire protocol. On every command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
Before a command runs, hoop.dev guardrails check its effect and refuse banned drops or writes with MongoDB error code 13, or hold risky commands for approval. On the way back, hoop.dev data masking rewrites sensitive fields in returned documents in memory, and every verdict is logged. See the open-source code on GitHub.
Frequently asked questions
What does the BadPerfCounterPath error name mean?
BadPerfCounterPath is the official MongoDB name for internal error code 180. It means the server found an invalid path when reading host performance counters.
Does mongodb error 180 damage my collections or indexes?
No, this error only affects how the server reads host performance metrics. Your stored documents, collections, and indexes remain safe and intact on disk.
Which role should engineers use to check database stats safely?
Assign a role with only the privilege actions needed for diagnostic checks. The built-in read role allows dbStats and collStats while blocking all data writes.
Related guides
In this post