{"record":{"id":"697073b5b59ed115","repo":"pola-rs/polars","slug":"cannot-parse-input-input-type-into-polars-data-t","errorCode":null,"errorMessage":"cannot parse input {input_type} into Polars data type{input_detail}","messagePattern":"cannot parse input (.+?) into Polars data type(.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/datatypes/_parse.py","lineNumber":197,"sourceCode":"    input\n        A union type, e.g. `str | None` (new syntax) or `Union[str, None]` (old syntax).\n    \"\"\"\n    # Strip \"optional\" designation - Polars data types are always nullable\n    inner_types = [tp for tp in get_args(input) if tp is not NoneType]\n\n    if len(inner_types) != 1:\n        _raise_on_invalid_dtype(input)\n\n    input = inner_types[0]\n    return parse_into_dtype(input)\n\n\ndef _raise_on_invalid_dtype(input: Any) -> NoReturn:\n    \"\"\"Raise an informative error if the input could not be parsed.\"\"\"\n    input_type = input if type(input) is type else f\"of type {type(input).__name__!r}\"\n    input_detail = \"\" if type(input) is type else f\" (given: {input!r})\"\n    msg = f\"cannot parse input {input_type} into Polars data type{input_detail}\"\n    raise TypeError(msg) from None\n","sourceCodeStart":179,"sourceCodeEnd":198,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/datatypes/_parse.py#L179-L198","documentation":"Error \"cannot parse input {input_type} into Polars data type{input_detail}\" thrown in pola-rs/polars.","triggerScenarios":"Thrown at py-polars/src/polars/datatypes/_parse.py:197 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}