XCOM: Enemy Unknown Guide

How To Fix "Failed to start game (app already running)" Errors for XCOM: Enemy Unknown

How To Fix “Failed to start game (app already running)” Errors

Overview

An easy fix for the rare-but-frustrating bug which causes Steam to think the game is constantly running, even after it’s been closed or even deleted.

Introduction

This guide is aimed at helping people solve one single specific problem: that you’ve started up the game once, it worked fine, and then when you went to play the game again, Steam gave you this error:

Not only does this prevent you from playing the game, it also stops you from properly closing Steam, since Steam won’t close with a game open and running. The only way to close Steam while this bug is in effect is to use the task manager to kill the process. It also prevents you from using the usual tools used to resolve game bugs: you can’t delete local content through Steam because it won’t do that to a game that’s currently running, and it even causes ‘verify integrity of game cache’ to behave oddly.

I’ve seen a bunch of people posting about this problem over the years, but I’ve never seen a solution that worked for them. Well, it happened to me today, and I figured out how to solve it, so I thought I’d share it with everyone else.

A Caveat

Because I didn’t discover the source of the problem until after I had totally uninstalled Steam, I don’t know for absolute certain that this is the cause of the problem, and because I don’t know how to recreate this bug, I have no way to test it. I’m fairly certain that this will solve your problems, but I can’t be 100%.

The Quickest Fixes

Of course, it’s possible for this error message to appear even when there’s no persistent problem. Before you proceed any further in the guide, you should check to see if a simpler solution might fix your problem.

  1. Use The Task Manager To Shut Down The Game. Just because you can’t see the game on the desktop doesn’t mean it isn’t running in the background. The first thing to check is ensure that the game really isn’t open. To do that, open the Windows Task Manager (either by hitting ctrl+alt+del and then clicking ‘task manager’ or, on newer versions of windows, right-clicking on the taskbar and clicking ‘task manager’, pop over to the Processes tab, and go hunting for one called XComGame.exe (for Enemy Unknown) or XcomEW.exe (for Enemy Within).

    If you find it, kill it and see if that fixes your problem. Otherwise, proceed to step two.

  2. With The XComGame.exe and/or XcomEW.exe Process Dead, Restart Steam. Close Steam (you may have to use the Task Manager again to do this) and reopen it. This might be enough to make Steam recognize that it’s closed down.
  3. Restart Your Computer. A simple enough solution that fixes most temporary issues. Just reboot your system and see if that fixes it.

If none of these fix your problem, congratulations, you’re well and truly bugged!

The Problem

This bug seems truly mysterious at first. It thinks the game is running, but the game’s clearly not running – indeed, once you’ve restarted your system, it can’t be running. Yet the issue persists across reboots, across installations, even across deletions of the game data. What could be causing this?

The answer is found in a little folder in your Steam folder, called steamappstemp.

I’m not sure exactly how Steam works, but it appears that when you run a game, it makes a copy of some game data, including the binary, and puts it in a temporary folder, in this case steamappstemp200510. 200510 is the game’s Steam Application ID number. When the game closes, Steam automatically deletes these files. Most of the time, this process works so smoothly you never know it’s happening. But with XCOM, this process can bug out badly. The binary isn’t deleted when the game closes. To be more precise, the binary can’t be deleted. If you try, Windows will tell you that the file is locked or in use by another program, and so cannot be deleted. Steam keeps seeing that the binary is still in the temp folder, and so thinks the game is still running.

As far as I can tell, what’s going on is that something the game does can inadvertantly trick Windows into thinking the temporary version of the binary is an essential system component. Once the System process decides that it’s interested in the file, it locks it down so nothing else can tamper with it. The operating system remembers this too, so it persists between sessions. This means that when the game/Steam tries to delete the temporary files when closing down the game, it quielty fails to do so, meaning Steam thinks the game is still running.

The way I discovered this was that I got frustrated with the error and decided to uninstall Steam altogether and start from scratch. I ran the uninstaller, which completely wiped my Steam folder out of existence…except for Steamsteamappstemp200510XEWBinariesWin32XcomEW.exe, which was left behind as the uninstaller couldn’t delete it. What’s a little scary about this is that this means that the error would persist even after a complete reinstall of Steam, if I reinstalled it to the same location.

The Solution

So, now that we know the problem is a file which failed to delete, we know the solution: delete that file. The problem, of course, is the same one which caused the bug in the first place: Windows has locked this file down, and it can’t be deleted by conventional means.

There are a bunch of different ways to delete locked files, and sticking ‘how to delete locked files’ into Google should get you some satisfaction. I’m going to show you how I did it, but there are other ways which will work, so long as the end result – the deletion of the temporary file – is the same.

First, download and install LockHunter[lockhunter.com], a free tool which unlocks and deletes files windows has locked down. Once you have it installed, navigate to the offending file, right click it, and click ‘what is locking this file?’, like so:

This will open up LockHunter. You’ll get a screen which looks much like this, except that it’ll be with your Enemy Unknown or Enemy Within binary, and it’ll say that it’s locked by System:

(Unfortunately, I didn’t think to take screenshots while I was doing this the first time, so I had to use another file to get this screenshot. Whoops!)

You can try to use the ‘unlock’ and ‘delete’ buttons at the bottom to fix the problem, but odds are they won’t work. Instead, click on the ‘Other…’ button and select ‘Delete At Next System Restart’, like so:

With that done, just restart your system. What this does is it tells LockHunter to wait until Windows has closed – and so is no longer protecting the file – and THEN delete it. When it boots back up, LockHunter will give you a little message telling you it successfully deleted the file. Your issue should now be solved!

If All Else Fails…

If your computer is being really stubborn and refusing to delete the file, you could always uninstall Steam and then reinstall it to a different location on your hard drive. If you can’t raise the bridge, then lower the river. Since the issue is caused by the presence of this file in the temporary folder of your Steam installation, if you can’t get rid of the file, you could always move the rest of your Steam installation away from it.

Note that uninstalling Steam will delete everything in the Steam folder, including all of your game data (but not, in most cases, save files), so be sure to back those up first. Just move them from the steamapps folder to somewhere else on the hard drive, and then once you’ve reinstalled Steam move them back into the new steamapps folder. When you try to install the games through Steam, Steam will automatically detect the game files in the steamapps folder.

SteamSolo.com