Error 0xc000012f, "Bad Image"

This code is Windows saying a file it tried to load is not a valid Windows executable or library. Microsoft's name for it is STATUS_INVALID_IMAGE_NOT_MZ, because the file is missing the MZ marker every Windows executable starts with. The on-screen message reads "Bad Image" followed by the file name, and the usual causes are a damaged file, a bad download, or a wrong file copied into the program folder by hand.

The fix, in order

  1. Read the file name in the Bad Image window. It tells you which file Windows rejected, and whether it belongs to the program, to a runtime, or to Windows itself.
  2. Remove hand-copied DLLs from the program folder. If you or a guide placed DLL files next to the program's .exe, move them aside. A copy of the wrong architecture or version shadows the real file and is the single most common cause.
  3. Reinstall the program from its official source. Uninstall it first, restart, then install a fresh download, since that replaces every file the program ships with.
  4. Reinstall the Visual C++ Redistributables. Download the 2015 to 2022 packages from Microsoft and install vc_redist.x86.exe and vc_redist.x64.exe. If the named file starts with msvcp, msvcr, or vcruntime, this is the fix.
  5. Run a full malware scan. Use Windows Security or your installed security software, since malware can replace system files with damaged or fake versions that Windows then rejects.
  6. Repair Windows files. In an admin Command Prompt run sfc /scannow, then DISM /Online /Cleanup-Image /RestoreHealth, and restart after each one finishes.
Do not download the named file from a DLL site. A single-file download cannot be verified as the right version or architecture, and a wrong copy is exactly what causes this error. Reinstalling the program or the runtime package is the fix that supplies the correct file.

If it still happens

If the error names a Windows system file and SFC cannot repair it, run the DISM step above and then run SFC again, since DISM repairs the store SFC draws from. If the error follows one program to a fresh install on a clean download, the program's installer itself may be damaged, so download it again from the maker and check the download size against the one the maker lists.

Common questions

What does Bad Image mean? It means Windows tried to load a file as a program or library and found it is not a valid Windows executable. The file may be damaged, truncated by a bad download, written for a different system, or a copy placed in the wrong folder by hand.

Is a Bad Image file a virus? Not necessarily. Most Bad Image errors come from damaged or mismatched files, not malware. But because malware can replace system files with its own versions, a full scan is a sensible step when the error names a Windows system file.

Why does Bad Image name a system DLL? The named file is the one Windows tried to load and rejected, which often means a copy of it in the program folder is shadowing the real system file. Removing hand-placed copies from the program folder usually lets Windows find the correct one.

Related errors

Error 0xc000007b · Error 0xc0000135 · MSVCP140.dll missing

Was this helpful?