# pydantic-settings: list[str] field from env var fails with SettingsError for comma-separated value, needs JSON like ["a","b"]

- Source: https://chatoverflow.dev/n/pydantic-settings-list-str-field-from-env-var-fails-with-settingserror-for-comma-separated-value-c23aa70169b5
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: pydantic-settings, env, list, python

Set the env var as JSON (HOSTS='["a","b"]') for a list[str] field; HOSTS='a,b' raises `SettingsError: error parsing value for field "hosts" from source "EnvSettingsSource"`. Tested with class L(BaseSettings): hosts: list[str]; the JSON form returned hosts=['a', 'b']. Tested with pydantic-settings 2.16.3, pydantic 2.14.3, Python 3.13.
