Technology Reviews

What Are Windows Runtime Errors and How Do You Fix Them?

Runtime errors in Windows are as old as the operating system itself. It’s a common error message to see when an app crashes, but what exactly is a runtime error, and what can you do about it?

Software development is complex, and modern applications rely on sophisticated libraries and supporting data to work as expected. This guide will help you understand why runtime errors happen and how to minimize them.

Table of Contents

What Is a Runtime Error?

The term “runtime error” refers to any application error when a program is executed. In other words, it happens to a running program. This is in contrast to errors that happen when a program is compiling. Compilation is the process of taking programming code (the “source” code) and converting it to binary code that can be excited by the operating system. If any part of the source code is invalid, the compiler will stop and give an error message.

Runtime errors happen when the compiled executable encounters a situation where it doesn’t know what to do next or something interferes with its normal operation. At this point, it will throw in the towel and give a runtime error.

Different Types of Runtime Error

Because runtime errors are defined so broadly, troubleshooting them can be tricky. It helps to understand what common types of error you may encounter. The five error types below are not exhaustive but are the most likely culprits.

Logic Errors

Logic errors happen when the computer literally encounters something that “does not compute.” It’s an output generated by the program’s code that produces an unexpected result, sometimes an impossible one, because the logic of the code doesn’t track or the programmers did not anticipate a specific set of conditions or inputs.

Memory Leaks

A memory leak happens when a program doesn’t give back memory that it requested after it no longer needs it. Over time memory leaks leave fewer and fewer resources for other programs, leading to degraded performance and, eventually, runtime errors. This is an interesting one because the software that reports a runtime error is usually not the one with a memory leak. It’s just a victim of the leak.

Dividing by Zero

It’s impossible to divide by zero, so when your computer tries to, it implodes into a black hole. Just kidding! It will crash the program with a runtime error along the lines of “cannot divide by zero.”

Undefined Objects

This error is usually associated with Java and JavaScript, where variables that have not been assigned a value or haven’t been declared. In other words, there’s no data in a variable, or the code refers to a variable that doesn’t exist. Basically, the programmer messed up in some way.

IO Errors

IO or Input/Output errors happen when a program tries to read or write data from a storage device and fails. This can be for various reasons, from a disconnected drive to a faulty hard drive or USB hardware. Scratched optical discs are another common cause of IO errors.

How to Fix Runtime Errors

So you’ve encountered a runtime error, and it’s bumming you out because you’re trying to get things done. While we’ve mentioned above that runtime errors come in different varieties, and specific errors may clue you into which type, there are some general fixes that may work regardless of the details.

Reboot Your Computer

Rebooting your computer may solve memory leak issues or clear out any temporary data caches or other working data that may have caused a program to stop. If an issue goes away after a reboot, it doesn’t help clear up the cause, but for occasional problems, a restart is a fast solution to try.

Update The Application

More often than not, runtime errors in software result from bugs in the software itself. Once a software developer is aware of these bugs, they’ll usually fix the problem and release an update for the application. So one of the first things you should do is check whether an update for your software is available.

Perhaps more importantly, when you encounter a Windows runtime error, you should report it to the developers. Sometimes there’s a reporting button alongside the error message; at other times you may have to take a screenshot or write down an error code and then get in touch via email or social media. Reporting a new bug can speed up getting a fix.

Update Windows

Runtime errors can also be due to bugs or other issues in Microsoft Windows itself, which are often rectified in Windows updates. Small issues are usually addressed in “hotfixes” which are small updates that fix specific urgent problems.

Alternatively, if a program has started giving runtime errors shortly after a Windows update, you may want to delete the last update until the developers update their software.

Update Your Outdated Drivers

Drivers are software that let the operating system control your hardware, such as the display adapter (AKA your graphics card). New software or newly-updated software may rely on features that only exist in the latest version of the driver, so when you update drivers for your computer components, you might fix hardware-related runtime errors.

Reinstall or Repair The Application

Runtime errors can be the result of corrupted application files or data. So when the program executable tries to access data it needs to work, it runs into errors because that data is wrong or missing.

By uninstalling the application and reinstalling it, you can overwrite that corrupt data with a fresh copy. You may not have to uninstall the application first. Many apps will offer a “repair” or “verify” option when you either run the installer again or try to uninstall them from the Programs and Features section of the Control Panel.

Close All Other Apps

Runtime errors that are caused by memory leaks or because a particular app needs more memory than is available can be mitigated by closing any nonessential programs that are open. You may also want to adjust the size of your swap file, to create a little more breathing room for apps that don’t fit into RAM.

If you’re sure that runtime errors are caused by memory capacity and not by a memory leak, you can also consider upgrading the amount of RAM in your computer to handle those heavier workloads.

Run Windows in Safe Mode or Perform a Clean Boot

If you suspect the runtime errors that you’re experiencing are the result of drivers or other software applications in the background, you can use either Safe Mode or a clean boot to confirm it.

Safe Mode is a special boot mode in Windows that only loads minimal drivers and Windows services. If the problem goes away under Safe Mode, you can be fairly certain the issue is either driver-related (update them) or a Windows service. Refer to our guide on how to start up in Safe Mode to see if it helps. If it does, you may want to experiment with disabling services in the MSConfig services tab.

A clean boot is almost the opposite of Safe Mode. Rather than loading a minimal operating system, Windows disables all third-party startup software. If a clean boot resolves the runtime error, it’s likely a third-party app that needs to be disabled, updated, or replaced. Refer to our guide on how to perform a clean boot.

Update Runtime Components

Software often depends on shared software libraries and standard software runtime components. If these are not installed, are corrupted, or are the wrong version it can cause issues. Examples of such runtime components include the Microsoft Visual C++ redistributable package.

You can download the required VC++ redistributable from the Microsoft website, but it’s usually included with the software that needs it. So reinstalling or repairing the app should also restore the Visual C++ runtime library. This is one of the easiest runtime component problems to identify, because the runtime error message will usually specify that it’s a “C++ runtime error.”

Check For Corrupt Files

Data corruption happens when the ones and zeros that make up a file are damaged or overwritten for some reason. Damage to system or application files can lead to unexpected runtime errors.

You can run the Windows System File Checker (SFC) to check and repair damage to system files. For applications, most of the time the installer will have a “repair” option if you run it without uninstalling the app first. With software clients such as Steam, you can also use the “verify” option on your games to check that the files are still whole.

Perform a Malware Scan

Many types of malware inject themselves into running code, corrupt data files, or alter executable files. All of which can lead to runtime errors. To rule out malware as the reason you’re getting errors, run a scan using your favorite antivirus or antimalware software.

Perform A Memory Test

Before your running software gets to your CPU for processing, it stops over in your RAM. If your RAM is faulty, this may cause runtime errors that are hard to track down. Run a memory test and make sure it’s not an issue with bits getting flipped in your memory modules!