{"record":{"id":"41a5c6a659986b56","repo":"pola-rs/polars","slug":"unsupported-encoding-encoding-for-hf-paths","errorCode":null,"errorMessage":"unsupported encoding {encoding} for hf:// paths","messagePattern":"unsupported encoding (.+?) for hf:// paths","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/csv/functions.py","lineNumber":546,"sourceCode":"        lf = lf.with_row_index(name, offset)\n\n    return lf._collect_eager()\n\n\n@removed_parameters(\n    RenamedParameter(\n        name=\"dtypes\",\n        new_name=\"schema_overrides\",\n        deprecated_in=\"0.20.31\",\n        removed_in=\"2.0\",\n    ),\n    RenamedParameter(\n        name=\"row_count_name\",\n        new_name=\"row_index_name\",\n        deprecated_in=\"0.20.4\",\n        removed_in=\"2.0\",\n    ),\n    RenamedParameter(\n        name=\"row_count_offset\",\n        new_name=\"row_index_offset\",\n        deprecated_in=\"0.20.4\",\n        removed_in=\"2.0\",\n    ),\n    RemovedParameter(\n        name=\"rechunk\",\n        removed_in=\"2.0\",\n        hint=\"call `rechunk()` on the resulting Dataframe if you need contiguous memory.\",\n    ),\n)\ndef scan_csv(\n    source: (\n        str\n        | Path\n        | IO[str]\n        | IO[bytes]\n        | bytes","sourceCodeStart":528,"sourceCodeEnd":564,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/py-polars/src/polars/io/csv/functions.py#L528-L564","documentation":"Guard in read_csv when reading from an hf:// (Hugging Face) path: only UTF-8 (the default) encoding is supported on that backend. The file is fetched over HTTP as text, so alternative encodings cannot be honored; download the file and read it locally to use another encoding.","triggerScenarios":"Thrown at py-polars/src/polars/io/csv/functions.py:546 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a supported encoding for hf:// paths (e.g. 'utf8'); lossy/other encodings are not supported there."],"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"}