What does "exited with code 9009" mean in a build?
Codemia Knowledge Hub ·
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. 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.
It shows up most often in Visual Studio build events, MSBuild scripts, npm scripts on Windows, and CI pipelines on Windows runners. The number 9009 (hex 0x2331) is specific to cmd.exe and does not appear on Linux or macOS.
What the 9009 error looks like
When cmd.exe cannot find a matching executable, internal command, batch file or script, it returns 9009, analogous to exit code 127 on Unix shells. The output typically looks like:
The first line is the actual diagnostic from cmd.exe. The second is MSBuild (or another build system) reporting the non-zero exit code.
Causes and fixes
1. Tool not installed
The script references a tool that is not installed on this machine, which is common when a project moves between developer machines or onto a CI runner without the same global tools.
Fix: install the missing tool. For npm-based tools, prefer local installation over global:
2. Directory not in PATH
The tool is installed but 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 the command name
A misspelled or wrong executable name gives the same error, often in copy-pasted build scripts:
4. Missing file extension or call
On Windows, executables need their extension (.exe, .cmd, .bat) unless it is listed in PATHEXT. Some tools, like npm, install as .cmd files, and calling them without the extension from certain contexts can fail:
call tells cmd.exe to invoke a batch file and return to the calling script afterward. Without it, cmd.exe transfers control to the batch file and never returns.
5. PowerShell syntax in Visual Studio build events
Pre-build and post-build events run inside cmd.exe by default, not PowerShell, so PowerShell commands fail:
Debugging exit code 9009 step by step
Step 1: Identify the exact command that failed. The build output usually shows the full command before the error. Copy it.
Step 2: Run it manually in cmd.exe. Test in the same shell the build uses; a command that works in PowerShell may not work in cmd.exe, and vice versa.
If it fails here too, the problem is the command itself, not the build system.
Step 3: Check whether the tool can be found.
where is the Windows equivalent of which. "Could not find files for the given pattern(s)" means the tool is not in PATH.
Step 4: Check PATH.
Verify that the tool's directory is listed.
Step 5: Check PATHEXT.
The default is .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC. A tool with a non-standard extension may not be found without the explicit extension.
Fixing 9009 in specific build systems
MSBuild / Visual Studio
Use call before batch files and verify PATH:
If the command is optional and the build should continue when it fails, wrap it:
Do not reach for || exit 0 or similar without knowing why the command failed; it hides the symptom and leaves the root cause in place.
npm scripts on Windows
npm scripts run through cmd.exe on Windows. Locally installed tools live in node_modules/.bin, which npm adds to PATH during script execution:
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 installed globally.
GitHub Actions on Windows runners
Pipelines on windows-latest hit this error when a tool is not pre-installed:
shell: cmd forces cmd.exe. Alternatively, shell: bash on Windows runners gives Unix-like behavior through Git Bash. Install every required tool as part of the pipeline setup.
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 |
Preventing 9009 on other machines
- Do not assume a tool is installed globally everywhere. Use project-local installs (
node_modules/.bin, virtual environments) andnpxor an equivalent. - Avoid absolute paths that exist only on one developer's machine. Use environment variables or relative paths.
Related reading
- What does Fatal error Unexpectedly found nil while unwrapping an Optional value mean?
- What does get-task-allow do in Xcode?
- What does is unavailable Use truncatingRemainder instead mean?
- What does it mean The serializable class does not declare a static final serialVersionUID field?
- What does it mean when MySQL is in the state Sending data?
- What does MissingManifestResourceException mean and how to fix it?
- What does mysql error 1025 HY000 Error on rename of './foo' errorno 150 mean?
- What does $NON-NLS-1$ mean?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseNo course covers this one yet
Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.
Build my courseInterview Questions practice on Codemia
Over 11,000 interview practice questions for 300+ companies, searchable by company and role.