0X800401E6

MK_E_INVALIDEXTENSION (0X800401E6): Fix Bad File Extension Errors

MK_E_INVALIDEXTENSION means a COM object is trying to bind to a file extension that isn't registered correctly. Here's how to fix it fast.

So you're trying to open a file, or your app is trying to create one, and Windows throws MK_E_INVALIDEXTENSION (0X800401E6) in your face. Annoying, right? Let's fix it. The error usually appears when a COM object calls MkParseDisplayName or MkParseDisplayNameEx with a file extension that isn't registered as a valid moniker. That's a mouthful, but what's actually happening is Windows can't map that extension to a CLSID because the registry entry is missing, corrupt, or pointing to a broken handler.

The Quick Fix: Rebuild the File Association

Most of the time, the extension causing trouble is .msg, .eml, .doc, or something your email client or Office app touches. The fix is to re-register the extension with the correct ProgID. Here's how:

  1. Press Win + R, type regedit, hit Enter. Yes, you're going into the registry. Back it up first if you're nervous.
  2. Navigate to HKEY_CLASSES_ROOT\.msg (replace .msg with your problem extension).
  3. Look at the (Default) value. It should point to a ProgID like Outlook.File.msg or similar. If it's blank, that's your problem.
  4. Double-click (Default) and set it to the correct ProgID. For Outlook .msg files, that's usually Outlook.File.msg. For .eml, it's Outlook.File.eml.
  5. Now go to HKEY_CLASSES_ROOT\Outlook.File.msg\shell\open\command and make sure the command points to the right executable. If it doesn't exist, you'll need to create it or repair Office.

If you don't know the ProgID, you can find it by opening a working file of the same type on another machine. Or just run a repair on the associated app. For Office, that's Control Panel > Programs > Microsoft Office > Change > Quick Repair. It takes two minutes and fixes this error more often than not.

Why This Actually Works

The reason step 3 matters is that MkParseDisplayName reads the extension from the display name and looks it up in HKEY_CLASSES_ROOT. If the extension key exists but has no default value, or the value points to a ProgID that doesn't exist, the function returns MK_E_INVALIDEXTENSION. Rebuilding that chain — extension to ProgID to CLSID to executable — makes the moniker parse succeed. It's not magic; it's just COM following a breadcrumb trail that someone stepped on.

Less Common Variations

Sometimes the extension is fine, but the COM object that owns it is broken. This happens with third-party shell extensions, old OCR tools, or PDF handlers that got half-uninstalled.

  • Broken shell extension: Run ShellExView from NirSoft, sort by company, and disable non-Microsoft extensions. If the error goes away, re-enable them one by one to find the culprit.
  • Corrupt user profile: Log in as a different user. If the error doesn't happen there, your profile's registry hive is damaged. The fix is to create a new profile and migrate your data.
  • Missing Visual C++ redistributable: Some COM components need specific VC++ runtimes. Install the latest Visual C++ Redistributable for Visual Studio 2015-2022 from Microsoft. It's a 20MB download that resolves a shocking number of weird COM errors.
  • Antivirus interference: Some AV products inject hooks into COM registration. Temporarily disable real-time protection and test. If it works, add an exclusion for the affected file type.

Prevention

Don't let a registry cleaner anywhere near your file associations. Those tools love to "optimize" HKEY_CLASSES_ROOT and break exactly what you just fixed. Also, uninstall old Office versions properly instead of deleting folders. And if you're a developer, always register your COM components with regsvr32 and test MkParseDisplayName with a real extension before shipping. The error is almost always a registration issue, not a code bug.

One more thing: if you're seeing this in a script or automation tool, check that you're passing a full path with a valid extension. MkParseDisplayName doesn't like URLs or paths with no extension at all. That's a different error, but people confuse the two all the time.

Related Errors in Windows Errors
0XC00D1B61 Fix NS_E_AUDIODEVICE_BUSY (0XC00D1B61) - Audio Device in Use 0XC000014B STATUS_PIPE_BROKEN (0XC000014B) – The Other End of the Pipe Closed 0XC0000122 STATUS_INVALID_COMPUTER_NAME (0XC0000122) Fix 0XC00D1BCC Fix NS_E_INVALID_VIDEO_WIDTH_ALIGN (0XC00D1BCC) in Windows

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.