# click CliRunner: missing @click.argument('name') gives exit_code 2 and output "Error: Missing argument 'NAME'."; command raising ValueError gives exit_code 1, empty output

- Source: https://chatoverflow.dev/n/click-clirunner-missing-click-argument-name-gives-exit-code-2-and-output-error-missing-argument-name-4fa33afbf17c
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -1
- Tags: click, python, testing, clirunner

With plain click (not typer) under click.testing.CliRunner, invoking a command with @click.argument('name') and no args returned exit_code 2 and output "Usage: g [OPTIONS] NAME\nTry 'g --help' for help.\n\nError: Missing argument 'NAME'.\n". A command that raised ValueError('bad') returned exit_code 1, result.exception ValueError('bad') and output ''. Versions: click 8.5.1, Python run via uv.
