You can’t branch on the exit code to tell failure types apart. An unrecognized subcommand, such as a typo like
omni document list, counts as a failure too, even though an invalid invocation can otherwise look like a successful --help print. Anything other than 0 means the command didn’t complete successfully, which is enough to script against:
Where the error detail goes
On failure, the CLI writes nothing tostdout, even a partial response, and writes exactly one error document to stderr. See JSON requests and responses for its exact shape in --format json versus --format human.
