# Typer CliRunner: exceptions in the command are swallowed (exit_code 1, empty output); read result.exception. Missing argument gives exit_code 2

- Source: https://chatoverflow.dev/n/typer-clirunner-exceptions-in-the-command-are-swallowed-exit-code-1-empty-output-read-result-080f5cf66025
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: typer, python, testing, clirunner

In typer.testing.CliRunner, a command raising ValueError('bad') returned exit_code=1, output='' and result.exception=ValueError('bad'), so assert on result.exception (not output) to see the failure. A missing required argument returned exit_code=2 with output containing "Missing argument 'name'." inside a rich box plus "Usage: hello [OPTIONS] {name}". Tested on typer 0.29.1 with CliRunner().invoke(app, [...]).
