{"record":{"id":"89cec8a2d8844e24","repo":"pola-rs/polars","slug":"more-schema-overrides-are-specified-than-there-are","errorCode":null,"errorMessage":"more schema overrides are specified than there are selected columns","messagePattern":"more schema overrides are specified than there are selected columns","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/csv/functions.py","lineNumber":422,"sourceCode":"                # pyarrow auto-generates names 'f0', 'f1', ... when there is no\n                # header, so index N maps to name 'fN'.\n                include_columns = [f\"f{column_idx}\" for column_idx in projection]\n            else:\n                # With a header, real names come from row 1 and aren't known\n                # until after the read. Leave the filter off and slice the\n                # Table by position later.\n                include_columns = None\n\n        with prepare_file_arg(  # type: ignore[no-matching-overload]\n            source,  # type: ignore[arg-type]\n            encoding=None,\n            use_pyarrow=True,\n            raise_if_empty=raise_if_empty,\n            storage_options=storage_options,\n        ) as data:\n            import pyarrow as pa\n            import pyarrow.csv\n\n            try:\n                tbl = pa.csv.read_csv(\n                    data,\n                    pa.csv.ReadOptions(\n                        skip_rows=skip_rows,\n                        skip_rows_after_names=skip_rows_after_header,\n                        autogenerate_column_names=not has_header,\n                        encoding=encoding,\n                    ),\n                    pa.csv.ParseOptions(\n                        delimiter=separator,\n                        quote_char=quote_char if quote_char else False,\n                        double_quote=quote_char is not None and quote_char == '\"',\n                    ),\n                    pa.csv.ConvertOptions(\n                        column_types=None,\n                        include_columns=include_columns,\n                        include_missing_columns=ignore_errors,","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/py-polars/src/polars/io/csv/functions.py#L404-L440","documentation":"Validation in read_csv: when columns are selected (by name or via new_columns) and schema_overrides is given as a list, its length must not exceed the number of selected columns — each dtype would map to a column that will not exist. Trim the overrides list to match the selection.","triggerScenarios":"Thrown at py-polars/src/polars/io/csv/functions.py:422 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide no more schema overrides than the number of selected columns, or widen the column selection."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"68506541d2de983056c9eb244e1ea05fab377dfc","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}