Exit codes and output
Process exit codes, stdout vs stderr, and JSON output conventions for nr
Exit codes
| Code | Constant | Meaning |
|---|---|---|
0 | OK | Success |
1 | Error | Runtime / operational failure (API error, verify failed, install failed) |
2 | Misuse | Invalid usage: missing required flags, unknown flags, bad --output / --section |
Scripts should treat 2 as “fix the invocation,” and 1 as “the command ran but the operation failed.”
stdout vs stderr
| Stream | Content |
|---|---|
| stderr | Logs, progress, prompts, warnings, human diagnostics |
| stdout | Machine-readable payloads when --output=json (and similar) |
This split lets you redirect JSON safely:
nr cluster verify --name edge-ams-01 --output json > report.jsonLogs still appear on the terminal (stderr) while report.json stays clean.
Commands that support --output
Typically: auth status, agent list/get/create, service-account list/get/create/update, cluster verify, cluster status|info|health, and the post-register verify report from cluster register.
Accepted values: text (default) or json.
Non-interactive safety
Destructive or reuse confirmations fail closed when stdin is not a TTY, unless you pass --yes / --force as documented for that command.