What does exited with code 9009 mean during this build?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Exit code 9009 means Windows cmd.exe could not find the program or command you tried to run. It is the Windows equivalent of "command not found" on Unix systems. The fix is almost always one of three things: the tool is not installed, its directory is not in PATH, or the build script has a typo in the command name.
This error shows up most often in Visual Studio build events, MSBuild scripts, npm scripts running on Windows, and CI pipelines using Windows runners. The number 9009 (hex 0x2331) is specific to cmd.exe and does not appear on Linux or macOS.
What Exit Code 9009 Actually Means
When cmd.exe tries to execute a command and cannot find a matching executable, internal command, batch file, or script, it returns exit code 9009. This is analogous to exit code 127 on Unix shells.
The error typically appears as:
The first line is the actual diagnostic from cmd.exe. The second line is MSBuild (or whatever build system) reporting the non-zero exit code.
Most Common Causes
1. Tool Not Installed
The build script references a tool that is not installed on the machine. This is especially common when moving a project from one developer's machine to another, or when a CI runner does not have the same global tools installed.
Fix: Install the missing tool. For npm-based tools, prefer local installation over global:
2. Directory Not in PATH
The tool is installed but its directory is not in the system's PATH environment variable. cmd.exe only searches directories listed in PATH.
Fix: Add the tool's directory to PATH:
Or use the full path in the build script:
3. Typo in Command Name
A simple spelling mistake or wrong executable name produces the same error:
This is more common than you might expect, especially in copy-pasted build scripts.
4. Missing File Extension on Windows
On Windows, executables need their extension (.exe, .cmd, .bat) unless the extension is listed in the PATHEXT environment variable. Some tools install as .cmd files (like npm), and calling them without the extension from certain contexts can fail:
The call keyword tells cmd.exe to invoke a batch file and return to the calling script afterward.
5. Build Events in Visual Studio
Visual Studio's Pre-build and Post-build events run inside cmd.exe. A common error is writing a command that works in PowerShell but not in cmd.exe:
Debugging Steps
Follow this checklist to diagnose exit code 9009 systematically:
Step 1: Identify the exact command that failed. The build output usually shows the full command before the error. Copy it.
Step 2: Open a cmd.exe window and run the command manually.
If it fails here too, the problem is the command itself, not the build system.
Step 3: Check if the tool exists.
where is the Windows equivalent of which. If it returns "Could not find files for the given pattern(s)," the tool is not in PATH.
Step 4: Check PATH.
Verify that the directory containing the tool is listed.
Step 5: Check PATHEXT.
Default value is .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC. If your tool has a non-standard extension, it may not be found without the explicit extension.
Fixing 9009 in Specific Build Systems
MSBuild / Visual Studio
Pre-build and post-build events run in cmd.exe. Use call before batch files and verify PATH:
If the command is optional (the build should continue even if it fails), wrap it:
npm Scripts on Windows
npm scripts execute through cmd.exe on Windows. Tools installed locally live in node_modules/.bin, which npm adds to PATH automatically during script execution. But directly calling npx or the tool from outside npm scripts may fail:
Running npm run build works because npm resolves webpack from node_modules/.bin. Running webpack --mode production directly in cmd may fail if webpack is not globally installed.
GitHub Actions (Windows Runners)
CI pipelines using windows-latest runners hit this error when a tool is not pre-installed:
Setting shell: cmd forces cmd.exe. Alternatively, use shell: bash on Windows runners to get Unix-like behavior through Git Bash.
Comparison: Exit Codes Across Platforms
| Error | Platform | Meaning |
| Exit code 9009 | Windows (cmd.exe) | Command not found |
| Exit code 1 | Windows (cmd.exe) | General error (catch-all) |
| Exit code 127 | Linux/macOS (bash/zsh) | Command not found |
| Exit code 126 | Linux/macOS (bash/zsh) | Permission denied (not executable) |
| Exit code 2 | Linux/macOS (bash/zsh) | Misuse of shell command / syntax error |
Common Pitfalls
- Assuming a tool is installed globally on all machines. Use project-local installations and
npx(or equivalent) instead of relying on globalPATH. - Using PowerShell syntax in Visual Studio build events. Build events execute in
cmd.exeby default, not PowerShell. - Forgetting
callbefore.cmdor.batfiles in build scripts. Withoutcall,cmd.exetransfers control to the batch file and never returns to the calling script. - Debugging in PowerShell when the build runs in
cmd.exe. A command that works in PowerShell may not work incmd.exeand vice versa. Test in the same shell the build uses. - Ignoring the exit code with
|| exit 0without understanding why the command failed. This suppresses the symptom but leaves the root cause in place. - Hardcoding absolute paths that only exist on one developer's machine. Use environment variables or relative paths instead.
Summary
- Exit code 9009 means
cmd.execould not find the command. It is Windows-specific. - The three most common causes are: tool not installed, directory not in
PATH, and typos in the command name. - Use
where some-toolto check whether a tool is findable fromcmd.exe. - Use
callbefore.cmdand.batfiles in build scripts to avoid silent failures. - Prefer project-local tool installations (
node_modules/.bin, virtual environments) over global installations for reproducible builds. - On CI, explicitly set the shell and install all required tools as part of the pipeline setup.

