# Exit codes and errors

Source: https://libtmux.org/en/py/stable/workspace/reference/exit-codes/

> Use process status and structured error codes to handle workspace failures.

tmuxp generally uses `0` for success, `1` for operation failures and `2` for
argument errors. Some commands have exceptions at this documented revision.

## Exceptions to check

- [`edit`](https://libtmux.org/en/py/stable/workspace/cli/edit/) does not propagate the editor child's status.
- Machine [`search`](https://libtmux.org/en/py/stable/workspace/cli/search/) can return normally with no output for an invalid pattern;
  a missing query can show human help.
- A missing import source exits with status `2`.
- A missing or unsupported tmux executable can print a diagnostic and return
  status `0` before argument parsing.
- [`freeze`](https://libtmux.org/en/py/stable/workspace/cli/freeze/) can catch a missing-session error, print it and return normally.

Read both the command's output and [reference page](https://libtmux.org/en/py/stable/workspace/cli/) before using
its status as the only success check.

[Command source](https://github.com/tmux-python/tmuxp/blob/618b398acc05506d3c682906c36cdeb29dcfa1ff/src/tmuxp/cli/__init__.py).
