If you’re getting the error message: “Failed to load xgameruntime.dll. Error code: 126” or “LoadLibrary failed with error 126: The specified module could not be found”.

This guide will walk you through multiple ways to fix it. This issue usually prevents games or apps from launching correctly on your Windows system.
What Is Error Code 126?
Error Code 126 is a Windows system error that indicates a DLL (Dynamic Link Library) file required by an application could not be loaded.
In this case, the missing or corrupted file is likely xgameruntime.dll, which is part of the Xbox Gaming Services used by many modern games on Windows 10 and Windows 11.
Why Does This Error Happen?
Here are the most common reasons:
- The xgameruntime.dll file is missing or corrupted.
- Gaming Services required by the game are not installed or are not working properly.
- Outdated drivers or conflicting software are preventing the file from loading.
- Important system libraries like Visual C++ Redistributables are not installed.
Step-by-Step Fix Using PowerShell
This is one of the most effective methods to fix the error by reinstalling the Xbox Gaming Services component.
Step 1: Open PowerShell as Administrator
- Click on the Start menu (or press the Windows key).
- Type PowerShell in the search bar.
- When “Windows PowerShell” appears in the list, right-click on it.
- Choose “Run as administrator” to launch PowerShell with full privileges.
This step is necessary because modifying system components like Gaming Services requires administrator access.
Step 2: Uninstall Existing Gaming Services
Copy and paste the following command into the PowerShell window, then press Enter:
get-appxpackage Microsoft.GamingServices | remove-AppxPackage -allusers
This command removes the current installation of Gaming Services from all user accounts. If the component is broken or partially installed, this step ensures a clean removal.
Step 3: Reinstall Gaming Services
Now, enter the following command in the same PowerShell window and press Enter:
start ms-windows-store://pdp/?productid=9MWPM2CQNLHN
This command will automatically open the Microsoft Store page for Gaming Services.
- Click on the Install button in the Microsoft Store.
- Wait for the installation to complete.
- Once finished, restart your computer.
After restarting, try launching the game or application that previously showed the error.
Other Fixes If the PowerShell Method Doesn’t Work
If you’re still facing the issue, try the following solutions.
1. Install the Xbox App
Some games require the Xbox app to be installed to work properly. You can download it from the Microsoft Store or from the official Xbox website.
Once installed, open the Xbox app and sign in with your Microsoft account. Then try launching the game again.
2. Install Microsoft Visual C++ Redistributables
Games and applications often rely on Visual C++ Runtime Libraries. Missing or outdated versions can cause DLL errors.
- Go to Microsoft’s official site and download the latest supported Visual C++ redistributables.
- Install both x64 (64-bit) and x86 (32-bit) versions.
- Restart your PC.
3. Update Your Graphics Drivers
Outdated or corrupt display drivers may interfere with DLL loading.
- Visit your GPU manufacturer’s website:
- Download and install the latest driver for your system.
- Restart the computer after installation.
4. Verify Game Files (if using Steam)
If you’re playing through Steam, verify that the game’s files are intact.
- Open the Steam app.
- Go to your Library.
- Right-click on the affected game and choose Properties.
- Click on the Local Files tab.
- Select “Verify Integrity of Game Files”.
Steam will scan the game’s files and automatically replace any that are missing or corrupted.
Frequently Asked Questions
Is xgameruntime.dll a virus?
- No. It is a legitimate DLL file used by Xbox Gaming Services. It is safe and required by many modern games on Windows.
Can I delete xgameruntime.dll to fix the issue?
- No. Deleting the file can cause more issues. Instead, use PowerShell to properly reinstall Gaming Services.
Does this issue affect only Xbox Game Pass titles?
- No. This error can affect any game that uses Xbox services, even if it’s launched through Steam or another platform.
Final Thoughts
The “Failed to load xgameruntime.dll – Error Code 126” message can be frustrating, but it’s usually easy to fix using PowerShell to reinstall Gaming Services. If that doesn’t work, updating system libraries, graphics drivers, and verifying game files are the next best steps.
Following this guide should help you get your game or application working again without the error.