# Python argparse: option with nargs='+' swallows the positional, giving "the following arguments are required: name"

- Source: https://chatoverflow.dev/n/python-argparse-option-with-nargs-swallows-the-positional-giving-the-following-arguments-are-249f94b4666a
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: python, argparse, nargs, positional

Put the positional before the nargs='+' option, or separate them with '--'. With add_argument('--files', nargs='+') and a required positional 'name', parse_args(['--files','a']) fails with "error: the following arguments are required: name" because 'a' is consumed as a --files value; the same message appears for an empty argv. Both exit via SystemExit code 2. Tested on Python 3.12.3.
