How to Fix “EXCEPTION ON INVALID FILE” BSOD on Windows 11

Some Windows 11 are reporting that they’re no longer able to use their PC. Every time they attempt to boot up the booting process is interrupted by the ‘Exception on Invalid File’ error before they’re eventually transitioned to a Black Screen of Death (BSOD) screen.

‘Exception on invalid file’ error on Windows 11

After we’ve investigated this issue thoroughly, it turns out that there are several different scenarios that might cause the ‘Exception on Invalid File’ on WIndows 11. Here’s a list of potential culprits:

  • Corrupted Boot Related Data – By far, the most common reason why you can expect to deal with this issue is some kind of corrupted BCD (Boot Configuration Data). If this scenario is applicable, you should be able to fix the issue by booting directly into the Advanced Startup menu and repairing the BCD component with a series of elevated CMD commands.
  • Bad Drive Sectors – Another possible culprit that might produce this error is a drive that is beginning to fail. If the damage is still minimal, you might be able to get away with it without changing the drive by running the CHKDSK utility to replace the sectors going bad with unused equivalents.
  • Corrupted System Files – System file corruption is also a viable cause that might produce this error. In this case, you should start by deploying a System File Checker scan from the Advanced Options menu and work your way to a clean install/repair install if the problem is still not solved.

Now that you are familiar with every potential cause of this issue, here’s a list of recommended troubleshooting methods that other affected users have successfully used to get to the bottom of this issue:

Fix all the Boot Related data

The first possible culprit that you should investigate is a potential issue affecting the Boot Configuration Data. If you end up seeing the ‘Exception on Invalid File’ error at every boot attempt, chances are you’re dealing with some type of corruption that is affecting the files that your operating system needs in order to complete the boot-up process.

In case this scenario looks like it could be applicable, you should use the Bootrec.exe utility to investigate a potential issue that currently affects the master boot record, the boot sector, or the boot configuration data.

Note: Obviously, since you are not likely able to complete the boot sequence, you will need to run this utility straight from the Startup Recovery menu – to achieve this, you either need to do 3 consecutive system interruptions or you need to plug in (or insert) a compatible Windows 11 installation media.

Follow the instructions below to run the Bootrec.exe utility and attempt to fix all the Boot related data that might be responsible for triggering the ‘Exception on Invalid File’ error:

  1. Start by inserting a compatible Windows 11 installation media. When prompted to boot from it, press any key.
    Boot from the installation media

    Note: If you don’t have a compatible Windows 11 installation media, you can create one by following this guide here. Additionally, you can skip this altogether and force your PC to boot directly into the Startup Recovery menu by forcing 3 consecutive shut-downs during the booting sequence.

  2. Once your PC boots from the installation media, click on Repair your computer (bottom-right corner).
    Repair your computer
  3. Once you are inside the Advanced Options menu, click on Troubleshooter, then click on Command Prompt from the list of available options.
    Accessing the Command Prompt window

    Note: This will automatically open an elevated Command Prompt window.

  4. Once you’re inside the elevated Command Prompt, type the following commands in the same order and press Enter after each command to scan and rebuild the entire boot configuration data:
    bootrec.exe /fixmbr 
    bootrec.exe /fixboot 
    bootrec.exe /scanos 
    bootrec.exe /rebuildbcd
  5. After every command has been processed successfully, close the utility and exit the Recovery menu, then allow your PC to boot up normally and see if the error is now resolved.

If the booting attempt gets interrupted by the same ‘Exception on Invalid File’ error, move down to the next potential fix below.

Perform a CHKDSK scan

If the first method was not effective in your case and you’ve excluded corrupted BCD data from the list of culprits, the next thing you should investigate is a drive that is beginning to fail.

Note: A failing drive does not automatically mean that you need to buy a new one. Well, you need to do it eventually, but you can postpone that moment by running the CHKDSK utility and allowing it to replace sectors that went bad with unused sectors.

This operation will work if the drive management is minimal, but won’t do much if the damage is extensive.

If you haven’t tried to go for this potential fix yet, follow the instructions below to run the CHKDSK utility via the Advanced Options menu:

  1. Produce 3 consecutive system interruptions during boot up or insert a Windows 11 installation media and boot from it to access the Repair your computer menu.
    Repair your computer
  2. Once you’re inside the Advanced Options menu, click on Troubleshoot, then click on Command Prompt from the new menu that just appeared.
    Accessing the Command Prompt window
  3. Once you’re inside the elevated Command Prompt, type the following command to deploy a CHKDSK scan:
    chkdsk C: /f /r /x
  4. Wait until the operation is complete, then exit the elevated Command Prompt and allow your operating system to boot up normally to check if the error has been fixed.

If the regular booting attempt still fails and you’re still presented with the ‘Exception on Invalid File’ error, move down to the next method below.

Perform an SFC Scan

If you ruled out a failing drive and corrupted boot configuration data from the list of potential culprits, the only viable scenario that’s known to produce the ‘Exception on Invalid File’ error is some kind of system file corruption.

When it comes to fixing system file corruption, the least-intrusive option is to deploy a System File Checker scan and allow it to repair corrupted Windows files with healthy equivalents from an archive that’s stored locally.

However, you won’t be able to do a regular SFC scan since you aren’t able to boot properly – the workaround in this place is to boot inside the Recovery Menu, then open an elevated CMD prompt from the Advanced Options menu.

Here’s what you need to do:

  1. Insert a compatible Windows 11 installation media and press any key when you are asked if you want to boot from the newly inserted medium.
    Boot from the installation media
  2. Once your PC boots from the installation media, click on Repair this Computer and wait until the Advanced Options menu is loaded. 

    Repair your computer
  3. Once you’re inside the Advanced Options menu, click on Troubleshoot.

     
    Accessing the Troubleshoot tab
  4. Once you’re inside the Troubleshoot menu, click on Command Prompt from the list of available options to open up a CMD window with admin access.
    Opening up a Command Prompt window
  5. Inside the elevated Command Prompt window, type the following command to initiate an SFC scan:
    sfc /scannow
  6. Wai until the operation is complete, then close the elevated CMD prompt and allow your PC to boot normally.

If the same ‘Exception on Invalid File’ error pops up before your PC eventually crashes, it means that you’re dealing with some type of system file corruption that cannon be fixed conventionally – in this case, follow the final potential fix below.

Perform a Repair install / Clean install

If you’ve come this far among the list of available troubleshooting guides, it’s clear that your current Windows installation is dealing with a serious case of system file corruption.

Since it’s almost impossible to figure out which files are causing the ‘Exception on Invalid File’ error during startup (unless you’re an expert at looking at crash dump files) the next best thing is to make sure that you replace every system file with a healthy equivalent that has no chance of being corrupted.

When it comes to achieving this, you really have two available options:

  • Clean install – This operation allows you to start from scratch with minimal hassle. While it will definitely fix any underlying corruption issues that your OS is dealing with, be prepared to lose everything on your operating system drive unless you back up your data in advance.
  • Repair install If you have important data on the OS drive that you cannot afford to lose, this is the way for you. This procedure will allow you to replace every Windows system file while keeping any personal files, data, apps, and applications present on the same partition as your Windows installation.
ABOUT THE AUTHOR

Kamil Anwar


Kamil is a certified MCITP, CCNA (W), CCNA (S) and a former British Computer Society Member with over 9 years of experience Configuring, Deploying and Managing Switches, Firewalls and Domain Controllers also an old-school still active on FreeNode.