diff --git a/pydantic_settings/sources.py b/pydantic_settings/sources.py index 6b292e1..656a32f 100644 --- a/pydantic_settings/sources.py +++ b/pydantic_settings/sources.py @@ -1935,7 +1935,8 @@ def _metavar_format_recurse(self, obj: Any) -> str: return self._metavar_format_choices([val.name for val in obj]) elif isinstance(obj, WithArgsTypes): return self._metavar_format_choices( - list(map(self._metavar_format_recurse, self._get_modified_args(obj))), obj_qualname=obj.__qualname__ + list(map(self._metavar_format_recurse, self._get_modified_args(obj))), + obj_qualname=obj.__qualname__ if hasattr(obj, '__qualname__') else str(obj), ) elif obj is type(None): return self.cli_parse_none_str