{"record":{"id":"8d150f025101cb52","repo":"pola-rs/polars","slug":"cannot-use-glob-patterns-and-integer-based-project","errorCode":null,"errorMessage":"cannot use glob patterns and integer based projection as `columns` argument\\n\\nUse columns: List[str]","messagePattern":"cannot use glob patterns and integer based projection as `columns` argument\\\\n\\\\nUse columns: List\\[str\\]","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/csv/functions.py","lineNumber":730,"sourceCode":"    new_columns\n        Provide an explicit list of string column names to use (for example, when\n        scanning a headerless CSV file). If the given list is shorter than the width of\n        the DataFrame the remaining columns will have their original name.\n    raise_if_empty\n        Control behavior when scanning empty files:\n\n        * `True`: Raise a `NoDataError`.\n        * `False`: Return 0 rows.\n\n        This defaults to `False` if `has_header=False` and a `schema` is specified,\n        and `True` otherwise.\n    truncate_ragged_lines\n        Truncate lines that are longer than the schema.\n    decimal_comma\n        Parse floats using a comma as the decimal separator instead of a period.\n    glob\n        Expand path given via globbing rules.\n    storage_options\n        Options that indicate how to connect to a cloud provider.\n\n        The cloud providers currently supported are AWS, GCP, and Azure.\n        See supported keys here:\n\n        * `aws <https://docs.rs/object_store/latest/object_store/aws/enum.AmazonS3ConfigKey.html>`_\n        * `gcp <https://docs.rs/object_store/latest/object_store/gcp/enum.GoogleConfigKey.html>`_\n        * `azure <https://docs.rs/object_store/latest/object_store/azure/enum.AzureConfigKey.html>`_\n        * Hugging Face (`hf://`): Accepts an API key under the `token` parameter: \\\n          `{'token': '...'}`, or by setting the `HF_TOKEN` environment variable.\n\n        If `storage_options` is not provided, Polars will try to infer the information\n        from environment variables.\n    credential_provider\n        Provide a function that can be called to provide cloud storage\n        credentials. The function is expected to return a dictionary of\n        credential keys along with an optional credential expiry time.\n","sourceCodeStart":712,"sourceCodeEnd":748,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/py-polars/src/polars/io/csv/functions.py#L712-L748","documentation":"Guard in read_csv when the source is a glob pattern and `columns` was given as integer indices. Glob expansion means multiple files with possibly differing schemas, so positional column selection is ambiguous; the code path falls back to scan+collect which only supports name-based selection. Pass column names instead of indices.","triggerScenarios":"Thrown at py-polars/src/polars/io/csv/functions.py:734 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["When using glob patterns, pass columns as a list of column name strings (List[str]); integer projection cannot be combined with globs."],"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"}