You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
action="append" on a list-typed field wraps each appended value in an extra list #366
Describe the bug simple_parsing silently produces a nested (corrupted) result when a list-annotated dataclass field uses action="append", instead of raising or producing a flat list.
Desktop (please complete the following information):
Version: 0.1.9
Python version: 3.14.6
Additional context
Root cause: In simple_parsing/wrappers/field_wrapper.py, the is_list branch that builds add_argument kwargs unconditionally sets nargs="*", regardless of the requested action.
That's correct for the default store action (nargs="*" collects all tokens from one occurrence into the list), but wrong for action="append": each occurrence should be parsed as a single element, and AppendAction appends that element to a running list.
Because nargs="*" is still forced, each single --header Auth occurrence gets bundled into its own one-item list (["Auth"]) before AppendAction appends it, yielding a list of one-item lists.
No error is raised, so this fails silently.
Confirmed workaround: explicitly passing nargs=None overrides the bad default and produces the correct flat list:
changed the title [-]action="append" on a list[...]-typed field wraps each appended value in an extra list[/-][+]action="append" on a list-typed field wraps each appended value in an extra list[/+]on Aug 15, 2026
Activity
[-]action="append" on a list[...]-typed field wraps each appended value in an extra list[/-][+]action="append" on a list-typed field wraps each appended value in an extra list[/+]