{"record":{"id":"f34f6ae2ea85ae4b","repo":"mlflow/mlflow","slug":"list-field-type-list-type-is-not-supported-in-da","errorCode":null,"errorMessage":"List field type {list_type} is not supported in dataclass {dataclass.__name__}","messagePattern":"List field type (.+?) is not supported in dataclass (.+?)","errorType":"validation","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/types/schema.py","lineNumber":1444,"sourceCode":"        if get_origin(effective_type) == list:\n            # It's a list, check the type within the list\n            list_type = get_args(effective_type)[0]\n            if is_dataclass(list_type):\n                dtype = _convert_dataclass_to_nested_object(list_type)  # Convert to nested Object\n                inputs.append(\n                    ColSpec(type=Array(dtype=dtype), name=field_name, required=not is_optional)\n                )\n            else:\n                if dtype := _map_field_type(list_type):\n                    inputs.append(\n                        ColSpec(\n                            type=Array(dtype=dtype),\n                            name=field_name,\n                            required=not is_optional,\n                        )\n                    )\n                else:\n                    raise MlflowException(\n                        f\"List field type {list_type} is not supported in dataclass\"\n                        f\" {dataclass.__name__}\"\n                    )\n        elif is_dataclass(effective_type):\n            # It's a nested dataclass\n            dtype = _convert_dataclass_to_nested_object(effective_type)  # Convert to nested Object\n            inputs.append(\n                ColSpec(\n                    type=dtype,\n                    name=field_name,\n                    required=not is_optional,\n                )\n            )\n        # confirm the effective type is a basic type\n        elif dtype := _map_field_type(effective_type):\n            # It's a basic type\n            inputs.append(\n                ColSpec(","sourceCodeStart":1426,"sourceCodeEnd":1462,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/types/schema.py#L1426-L1462","documentation":"When a dataclass field is a list, MLflow maps the list's element type via _map_field_type; only basic dtypes (str, float, int, bool, bytes, datetime/date, numpy types) and nested dataclasses are supported. An element type with no mapping, e.g. List[dict], List[Set[str]], or List[SomeEnum], raises this MlflowException.","triggerScenarios":"A dataclass field annotated List[X] where X is not a dataclass and not in _map_field_type's mapping (e.g. List[dict], List[Union[...]], List[object], List[CustomClass]) passed to convert_dataclass_to_schema.","commonSituations":"Model inputs containing lists of dictionaries or heterogeneous objects; nested dicts that should have been modeled as dataclasses; using enums or third-party types inside lists.","solutions":["Replace List[dict] with List[NestedDataclass] where NestedDataclass is a @dataclass with typed fields","Flatten or change the element type to a supported basic type (str, int, float, bool, bytes, datetime)","If the data is genuinely unstructured, drop the field from the schema or use a pydantic-based signature path that supports more types"],"exampleFix":"// before\n@dataclass\nclass Input:\n    rows: List[dict]\n// after\n@dataclass\nclass Row:\n    name: str\n    score: float\n@dataclass\nclass Input:\n    rows: List[Row]","handlingStrategy":"validation","validationCode":"from typing import get_type_hints, get_origin\nSUPPORTED = {str, int, float, bool, bytes}\nfor name, t in get_type_hints(MyInput).items():\n    if get_origin(t) is list:\n        elem = get_args(t)[0]\n        from dataclasses import is_dataclass\n        if not (is_dataclass(elem) or elem in SUPPORTED):\n            raise TypeError(f\"List field {name}: unsupported element {elem}\")","typeGuard":"def is_supported_list(t) -> bool:\n    from typing import get_origin, get_args\n    from dataclasses import is_dataclass\n    return get_origin(t) is list and (is_dataclass(get_args(t)[0]) or get_args(t)[0] in {str, int, float, bool, bytes})","tryCatchPattern":"try:\n    schema = convert_dataclass_to_schema(Input)\nexcept MlflowException as e:\n    if \"List field type\" in str(e) and \"not supported\" in str(e):\n        logging.error(\"Change list element type: %s\", e)\n    raise","preventionTips":["Avoid List[dict]; model rows as nested dataclasses","Keep list element types to basic dtypes or dataclasses","Test schema conversion in CI whenever the dataclass changes"],"tags":["python","dataclass","list","schema","unsupported-type"],"backgroundTag":"unsupported-schema-field-type","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}