{"record":{"id":"1b7b7a8895eeca28","repo":"pola-rs/polars","slug":"unsupported-null-type-null-type-r","errorCode":null,"errorMessage":"unsupported null type: {null_type!r}","messagePattern":"unsupported null type: (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/interchange/from_dataframe.py","lineNumber":295,"sourceCode":"        return data.is_not_nan()\n\n    elif null_type == ColumnNullType.USE_SENTINEL:\n        if not allow_copy:\n            msg = \"bitmask must be constructed\"\n            raise CopyNotAllowedError(msg)\n\n        sentinel = pl.Series([null_value])\n        try:\n            if column_dtype.is_temporal():\n                sentinel = sentinel.cast(column_dtype)\n            return data != sentinel  # noqa: TRY300\n        except InvalidOperationError as e:\n            msg = f\"invalid sentinel value for column of type {column_dtype}: {null_value!r}\"\n            raise TypeError(msg) from e\n\n    else:\n        msg = f\"unsupported null type: {null_type!r}\"\n        raise NotImplementedError(msg)\n\n\ndef _construct_validity_buffer_from_bitmask(\n    buffer: Buffer,\n    null_value: int,\n    length: int,\n    offset: int = 0,\n    *,\n    allow_copy: bool,\n) -> Series:\n    buffer_info = (buffer.ptr, offset, length)\n    s = pl.Series._from_buffer(Boolean, buffer_info, buffer)\n\n    if null_value != 0:\n        if not allow_copy:\n            msg = \"bitmask must be inverted\"\n            raise CopyNotAllowedError(msg)\n        s = ~s","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/interchange/from_dataframe.py#L277-L313","documentation":"Polars handles exactly four null representations from the interchange protocol: USE_BITMASK (with USE_BYTEMASK as a variant), USE_NAN, and USE_SENTINEL. Any other ColumnNullType value falls into the else branch and raises NotImplementedError. In practice this means the producer speaks a protocol revision newer than the polars version in use.","triggerScenarios":"A producer's describe_null returns a ColumnNullType enum value outside the four kinds polars implements (e.g. a future or extension enum member).","commonSituations":"Version skew where the producer library is newer than polars; experimental producers implementing draft spec extensions; enum values leaking across incompatible protocol versions.","solutions":["Upgrade polars to a version that supports the null type","Pin or configure the producer to a protocol revision polars supports","Report the gap to the polars issue tracker, including producer name and version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"from polars.interchange.protocol import ColumnNullType\n\nSUPPORTED_NULL_TYPES = {\n    ColumnNullType.USE_BITMASK,\n    ColumnNullType.USE_BYTEMASK,\n    ColumnNullType.USE_NAN,\n    ColumnNullType.USE_SENTINEL,\n}\n\ndef null_types_supported(df) -> bool:\n    proto = df.__dataframe__(allow_copy=False)\n    return all(\n        col.describe_null()[0] in SUPPORTED_NULL_TYPES\n        for col in proto.get_columns()\n    )","typeGuard":null,"tryCatchPattern":"try:\n    out = pl.from_dataframe(df)\nexcept NotImplementedError as e:\n    if 'unsupported null type' in str(e):\n        raise RuntimeError(\n            'producer uses a null type this polars version does not support; '\n            'upgrade polars or pin the producer protocol version'\n        ) from e\n    raise","preventionTips":["Pin producer and polars versions together in lockfiles so protocol revisions stay compatible","Check describe_null() kinds of all columns when certifying a new producer","Watch polars release notes for interchange protocol changes before upgrading producers"],"tags":["polars","interchange-protocol","null-handling","not-implemented","version-skew"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}