Exit codes

What each mbt exit code means, which commands return it, and how to use the codes in scripts and on a build machine.

Last updated Oct 26, 2026Edit this pageVersion 1.0.0

Every mbt command returns a small, fixed set of exit codes, so scripts and CI jobs can tell a failed build from a mistyped command. The wrapper scripts pass the code through unchanged.

The codes

CodeMeaningTypical causes
0SuccessThe command did what it was asked
1The work failedCompile or link errors, a required tool missing in doctor, a failed cook or package step
2Usage or setup problemNo engine install found, an invalid option value, a contradictory pair of options, a bad --project path, a release package without content keys
3Shader compiler not foundDXC is missing when shaders must compile

1: the work failed

The command ran and the result was a failure. build returns 1 when any module fails to compile or link, or when a rules file does not compile. doctor returns 1 when a required tool is missing. package returns 1 when a step fails, for example a cook error, a monolithic import check, or a release symbol upload that was attempted and failed.

Note

A missing or too old C++ toolchain also ends build with 1: toolchain detection fails the build rather than returning a code of its own. Run mbt doctor to see what is missing.

2: the command could not run as asked

mbt returns 2 before doing any work when, for example:

  • it cannot find the engine above the current directory (run it through mbt.cmd at the root of the install);
  • --platform, --targets or package --target has an unknown value;
  • --hot-reload is passed without -t;
  • package gets both --monolithic and --modular, a mobile platform, or an output folder that is not empty and does not look like an earlier package;
  • --project does not point at an existing .mproject;
  • a release package's project has no content keys and --unprotected was not passed.

3: shader compiler not found

package and package-android return 3 when they must compile shaders and the shader compiler (DXC) that ships with the install cannot be found; $VULKAN_SDK/Bin and PATH are fallbacks. Reinstall to restore it.

Using exit codes in scripts

PowerShell
.\mbt.cmd build -t MyGame --extra-source D:/Projects/MyGame/Source
if ($LASTEXITCODE -ne 0) {
    Write-Error "Build failed with exit code $LASTEXITCODE"
    exit $LASTEXITCODE
}

Page feedback

Was this page helpful?