How to Fix MongoDB Error 179 (WindowsPdhError)

Published
Length
3 min read

Luis Felipe Dias

All posts

You get mongodb error 179 when the database fails to read Windows performance counters. You fix it by rebuilding corrupted Windows counter registries and checking service account permissions. MongoDB names this failure WindowsPdhError in its official error list. The Pdh part stands for Performance Data Helper on Windows hosts. The database uses this Windows system to track host memory, disk, and processor stats. When the helper call fails, the server logs code 179 and stops collecting those met

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 179 when the database fails to read Windows performance counters. You fix it by rebuilding corrupted Windows counter registries and checking service account permissions.

MongoDB names this failure WindowsPdhError in its official error list. The Pdh part stands for Performance Data Helper on Windows hosts. The database uses this Windows system to track host memory, disk, and processor stats. When the helper call fails, the server logs code 179 and stops collecting those metrics.

Root causes of mongodb error 179 in Windows

Windows stores system health metrics inside the Performance Data Helper registry. MongoDB polls these counters to build its own internal server status reports. Several host problems can break this link between the database and the operating system.

First, the Windows performance counter registry can become corrupt after a bad system patch. Second, the Windows account that runs the database might lack rights to read host metrics. Third, a host resource spike can cause the Windows counter query to time out. Fourth, a third-party monitoring agent might lock or disable the counter library on that machine.

This error only happens on Windows server deployments. Linux and macOS servers do not use the Windows Performance Data Helper library. Still, a client app on any system can receive this error from a Windows database host.

How to diagnose and fix the failure in production

Start your check by reading the database log file on the affected Windows host. Look for the exact WindowsPdhError message and note the timestamp of the failure. Next, open the Windows event viewer on that same server. Check if other system tools report broken performance counters at the exact same time.

You can test the host counters using native Windows system health tools. If the counters fail to load there, the Windows registry needs a rebuild. A Windows admin can reload the base counter strings using standard system maintenance tools. After the rebuild finishes, restart the monitoring check to see if the error clears.

MongoDB Authentication & Authorization + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

If the counters work for admins, check the Windows service account that runs the database. Make sure that account belongs to the local Windows group allowed to read performance logs. Never grant full local admin rights to the database service account just to clear this error.

Safe database role setup during repair

Engineers often run database status checks to see if host metrics return after a fix. Keep database permissions tight while your team checks the server state. MongoDB grants access through role-based rules that apply to specific databases and collections.

Give your responders the least privilege needed to check the database. The built-in read role grants read access to non-system collections in a single database. It allows actions like find, listCollections, listIndexes, dbStats, collStats, and changeStream. It blocks write actions like insert, update, remove, and dropCollection so responders cannot change data by mistake.

Do not hand out the readWrite role when an engineer only needs to check server health. That role allows users to create or drop collections and indexes, which adds risk during an incident. Also protect sensitive user data when engineers run find queries to test database health. Data masking rewrites matched fields like emails, phone numbers, card numbers, and national IDs in query results.

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 WindowsPdhError mean in MongoDB?

WindowsPdhError is the official name for error code 179 in MongoDB. It means a call to the Windows Performance Data Helper library failed on the host.

Does mongodb error 179 corrupt stored data?

No, this error only affects how the server reads host performance metrics from Windows. Your stored collections and indexes remain intact while you fix the Windows counters.

Can mongodb error 179 happen on Linux servers?

No, Linux servers do not use the Windows Performance Data Helper system. You will only see this error when the database server runs on Windows.

The query runs. The emails stay hidden.