{"record":{"id":"8229b68e281bfcd3","repo":"pola-rs/polars","slug":"dtypes-must-be-fully-specified-got-tp-r","errorCode":null,"errorMessage":"dtypes must be fully-specified, got: {tp!r}","messagePattern":"dtypes must be fully-specified, got: (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/schema.py","lineNumber":56,"sourceCode":"    from polars._dependencies import pyarrow as pa\n\n\ndef _required_init_args(tp: DataTypeClass) -> bool:\n    return bool(tp.__annotations__)\n\n\nBaseSchema = OrderedDict[str, DataType]\nSchemaInitDataType: TypeAlias = DataType | DataTypeClass | PythonDataType\n\n__all__ = [\"Schema\"]\n\n\ndef _check_dtype(tp: DataType | DataTypeClass) -> DataType:\n    if not isinstance(tp, DataType):\n        # note: if nested/decimal, or has signature params, this implies required args\n        if tp.is_nested() or tp.is_decimal() or _required_init_args(tp):\n            msg = f\"dtypes must be fully-specified, got: {tp!r}\"\n            raise TypeError(msg)\n        tp = tp()\n    return tp  # type: ignore[return-value]\n\n\ndef _is_arrow_schema_exportable(obj: Any) -> TypeIs[ArrowSchemaExportable]:\n    return hasattr(obj, \"__arrow_c_schema__\")\n\n\nclass Schema(BaseSchema):\n    \"\"\"\n    Ordered mapping of column names to their data type.\n\n    Parameters\n    ----------\n    schema\n        The schema definition given by column names and their associated\n        Polars data type. Accepts a mapping, or an iterable of tuples, or any\n        object implementing the  `__arrow_c_schema__` PyCapsule interface","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/schema.py#L38-L74","documentation":"pl.Schema requires fully-specified DataType instances. Parameterized dtypes given as classes without arguments (e.g. pl.List, pl.Decimal, pl.Array) are rejected because required parameters are missing.","triggerScenarios":"pl.Schema({\"a\": pl.List}) or pl.Schema({\"d\": pl.Decimal}) — passing the bare class for a nested/decimal/parameterized dtype; also via __setitem__ (schema[\"a\"] = pl.List).","commonSituations":"Typing dtypes from memory without parameters; generic schemas where nested types were left unspecified.","solutions":["Fully specify the dtype: pl.List(pl.Int64), pl.Array(pl.Float64, 3), pl.Decimal(38, 10)","Use scalars like pl.Int64 directly (they don't need args)","Instantiate with required args before assigning into the schema"],"exampleFix":"// before\npl.Schema({\"a\": pl.List})\n// after\npl.Schema({\"a\": pl.List(pl.Int64)})","handlingStrategy":"validation","validationCode":"def fully_specified(tp) -> bool:\n    return isinstance(tp, pl.DataType)\npl.Schema({k: v if fully_specified(v) else v() for k, v in raw.items()})","typeGuard":"def is_concrete_dtype(tp) -> bool:\n    return isinstance(tp, pl.DataType)","tryCatchPattern":"try:\n    schema = pl.Schema(raw)\nexcept TypeError as e:\n    schema = pl.Schema({k: v() for k, v in raw.items()})","preventionTips":["Always parameterize nested dtypes: pl.List(pl.Int64), pl.Array(...), pl.Decimal(...)","Validate schemas in one helper before constructing pl.Schema","Remember bare classes are type specs, not instances"],"tags":["python","polars","schema","dtype"],"backgroundTag":"schema-validation-failed","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"}