{"record":{"id":"d0e70cf76947a14c","repo":"pola-rs/polars","slug":"unsupported-data-type-dtype-d0e70c","errorCode":null,"errorMessage":"unsupported data type: {dtype}","messagePattern":"unsupported data type: (.+?)","errorType":"validation","errorClass":"InvalidArgument","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/testing/parametric/strategies/data.py","lineNumber":522,"sourceCode":"        strategy = lists(\n            inner,\n            min_size=size,\n            max_size=size,\n            allow_null=allow_null,\n            **kwargs,\n        )\n    elif dtype == Map:\n        key = getattr(dtype, \"key\", None) or Null()\n        value = getattr(dtype, \"value\", None) or Null()\n        strategy = maps(key, value, allow_null=allow_null, **kwargs)\n    elif dtype == Struct:\n        fields = getattr(dtype, \"fields\", None) or [Field(\"f0\", Null())]\n        strategy = structs(fields, allow_null=allow_null, **kwargs)\n    elif isinstance(dtype, BaseExtension):\n        strategy = data(dtype.ext_storage(), allow_null=allow_null, **kwargs)\n    else:\n        msg = f\"unsupported data type: {dtype}\"\n        raise InvalidArgument(msg)\n\n    if allow_null:\n        strategy = nulls() | strategy\n\n    return strategy\n","sourceCodeStart":504,"sourceCodeEnd":528,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/testing/parametric/strategies/data.py#L504-L528","documentation":"The data() dispatcher maps a polars dtype to a Hypothesis strategy and raises InvalidArgument for dtypes it has no branch for. Any dtype not matched by the known numeric, temporal, string, list, struct, or extension branches lands in the final else.","triggerScenarios":"Calling data(dtype) with an unsupported dtype such as pl.Map variants not handled, Categorical variants, or a custom/unregistered DataType; passing a DataTypeClass instead of an instantiated dtype when required.","commonSituations":"Adding a new polars dtype that the testing strategies module has not been updated for; passing exotic dtypes (BinaryOffset, Unknown) into parametric strategies; plugin/extension dtypes from pyo3-polars.","solutions":["Use a supported dtype, or instantiate the dtype with defaults (e.g. pl.Datetime('us')).","Check the dtype against polars' supported list for parametric strategies before calling data().","If this is a newly added polars dtype, update strategies/data.py to add a branch for it."],"exampleFix":"// before\ndata(dtype=pl.Unknown)\n// after\ndata(dtype=pl.String)","handlingStrategy":"try-catch","validationCode":"SUPPORTED = (pl.Int8, pl.Int16, pl.Int32, pl.Int64, pl.UInt8, pl.UInt16, pl.UInt32, pl.UInt64, pl.Float32, pl.Float64, pl.String, pl.Boolean, pl.Date, pl.Datetime, pl.Duration, pl.Time, pl.List, pl.Struct)\nif not any(dtype == d for d in SUPPORTED):\n    raise ValueError(f\"dtype {dtype} not supported by parametric strategies\")","typeGuard":"def is_strategy_supported(dtype: pl.DataType) -> bool:\n    try:\n        data(dtype)\n        return True\n    except Exception:\n        return False","tryCatchPattern":"from polars.exceptions import InvalidArgument\ntry:\n    strategy = data(dtype)\nexcept InvalidArgument as e:\n    pytest.skip(f\"no strategy for {dtype}: {e}\")","preventionTips":["Keep test dtypes within the set the parametric strategies support.","Instantiate dtype classes with defaults before passing them to data().","When polars adds dtypes, check the testing strategies module before adopting them in hypothesis tests."],"tags":["polars","hypothesis","dtype","testing"],"backgroundTag":"unsupported-dtype","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}