When using cli_parse_args=True to parse command line arguments into a set[str] field, pydantic-settings 2.13 raises a pydantic_settings.exceptions.SettingsError: Parsing error encountered for source_keys: 'set' object is not subscriptable
Steps to reproduce:
from pydantic_settings import BaseSettings
class Definition(BaseSettings, cli_parse_args=True):
keys: set[str]
test = Definition()
print(test.keys)
Error traceback:
Traceback (most recent call last):
File ".../lib/python3.10/site-packages/pydantic_settings/sources/providers/cli.py", line 684, in _merge_parsed_list
return self._merged_list_to_str(merged_list, field_name)
File ".../lib/python3.10/site-packages/pydantic_settings/sources/providers/cli.py", line 624, in _merged_list_to_str
is_num_type_str = type(list_adapter.validate_python(['1'])[0]) is str
TypeError: 'set' object is not subscriptable
Environment:
- pydantic-settings: 2.13
- python: 3.10
- OS: macOS 26.2 (Apple Silicon)
The regression appeared with version 2.13.0, same code executed with version 2.12.0 works fine.
When using cli_parse_args=True to parse command line arguments into a
set[str]field, pydantic-settings 2.13 raises apydantic_settings.exceptions.SettingsError: Parsing error encountered for source_keys: 'set' object is not subscriptableSteps to reproduce:
Error traceback:
Environment:
The regression appeared with version 2.13.0, same code executed with version 2.12.0 works fine.