Exit codes

Interpret OnMCU CLI process exit codes in scripts and CI.

The CLI returns 0 only when the command succeeds. If a hardware job fails, is cancelled, or times out, onmcu run also fails.

CodeMeaning
0Success; for run, the hardware job completed successfully.
2Unexpected trailing command arguments.
3The configuration file could not be read or parsed.
4Missing, malformed, or rejected authentication credential; also used for keyring access failures.
5API request failure.
6Firmware file or upload failure.
7Interactive login input or API-key validation failure.
8No matching board identifier was found.
9The pending job was cancelled because no device became available.
10The hardware job failed.
11The hardware job was cancelled.
12The hardware job timed out.
13The CLI could not determine a final job status.
14The authenticated account does not have permission for the request.

Shell example

if onmcu run --board NUCLEO-H743ZI --file firmware.elf; then
  echo "hardware test passed"
else
  status=$?
  echo "hardware test failed with OnMCU exit code $status" >&2
  exit "$status"
fi

Device and CLI exit codes

The result passes through three layers:

  • Firmware reports completion to the debugger, for example with ARM semihosting SYS_EXIT_EXTENDED.
  • The OnMCU job records that result as completed or failed.
  • The CLI maps the final job state to its own stable process exit code (0 or 10, respectively).

Read End a run with semihosting for C and Rust examples that end immediately instead of waiting for the run timeout.

CLI usage errors produced directly by the argument parser may also return 2, in line with normal command-line conventions.

On this page