{"record":{"id":"5d6c6d7e19e2a8e7","repo":"pola-rs/polars","slug":"expected-type-int-str-got-qualified-type-nam-5d6c6d","errorCode":null,"errorMessage":"expected type 'int | str', got {qualified_type_name(item)!r}","messagePattern":"expected type 'int \\| str', got (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/series/struct.py:43","lineNumber":44,"sourceCode":"    def __getitem__(self, item: int | str) -> Series:\n        if isinstance(item, int):\n            return self.field(self.fields[item])\n        elif isinstance(item, str):\n            return self.field(item)\n        else:\n            msg = f\"expected type 'int | str', got {qualified_type_name(item)!r}\"\n            raise TypeError(msg)","sourceCodeStart":null,"sourceCodeEnd":null,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/py-polars/src/polars/struct.py#L44","documentation":"Subscript guard on StructNameSpace: __getitem__ was called with an item that is neither an int (field index) nor a str (field name) — e.g. a slice or tuple. The qualified type name of the offending item is included in the message.","triggerScenarios":"Thrown at py-polars/src/polars/struct.py:44 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Index the struct namespace with an int position or a str field name, e.g. `s.struct[0]` or `s.struct['field_name']`."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}