{"record":{"id":"ead5b3c50bf2bf03","repo":"pola-rs/polars","slug":"array-constructor-is-missing-the-required-argument","errorCode":null,"errorMessage":"Array constructor is missing the required argument `shape`","messagePattern":"Array constructor is missing the required argument `shape`","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/datatypes/classes.py","lineNumber":1230,"sourceCode":"\n    def __init__(\n        self,\n        inner: PolarsDataType | PythonDataType,\n        shape: int | tuple[int, ...] | None = None,\n        *,\n        width: int | None = None,\n    ) -> None:\n        if width is not None:\n            from polars._utils.deprecation import issue_deprecation_warning\n\n            issue_deprecation_warning(\n                \"the `width` parameter for `Array` is deprecated. Use `shape` instead.\",\n                version=\"0.20.31\",\n            )\n            shape = width\n        elif shape is None:\n            msg = \"Array constructor is missing the required argument `shape`\"\n            raise TypeError(msg)\n\n        inner_parsed = polars.datatypes.parse_into_dtype(inner)\n        inner_shape = inner_parsed.shape if isinstance(inner_parsed, Array) else ()\n\n        if isinstance(shape, int):\n            self.inner = inner_parsed\n            self.size = shape\n            self.shape = (shape,) + inner_shape\n\n        elif isinstance(shape, tuple) and isinstance(shape[0], int):  # type: ignore[redundant-expr]\n            if len(shape) > 1:\n                inner_parsed = Array(inner_parsed, shape[1:])\n\n            self.inner = inner_parsed\n            self.size = shape[0]\n            self.shape = shape + inner_shape\n\n        else:","sourceCodeStart":1212,"sourceCodeEnd":1248,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/datatypes/classes.py#L1212-L1248","documentation":"Error \"Array constructor is missing the required argument `shape`\" thrown in pola-rs/polars.","triggerScenarios":"Thrown at py-polars/src/polars/datatypes/classes.py:1230 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"}