{"record":{"id":"f8044790adf94803","repo":"pola-rs/polars","slug":"err-path","errorCode":null,"errorMessage":"{err}: {path}","messagePattern":"\\{err\\}: \\{path\\}","errorType":"exception","errorClass":"PolarsError","httpStatus":null,"severity":"error","filePath":"crates/polars-utils/src/io.rs","lineNumber":15,"sourceCode":"use std::fs::File;\nuse std::io;\nuse std::path::Path;\n\nuse polars_error::*;\n\npub fn _limit_path_len_io_err(path: &Path, err: io::Error) -> PolarsError {\n    let path = path.to_string_lossy();\n    let msg = if path.len() > 88 && !polars_config::config().verbose() {\n        let truncated_path: String = path.chars().skip(path.len() - 88).collect();\n        format!(\"{err}: ...{truncated_path} (set POLARS_VERBOSE=1 to see full path)\")\n    } else {\n        format!(\"{err}: {path}\")\n    };\n    io::Error::new(err.kind(), msg).into()\n}\n\npub fn open_file(path: &Path) -> PolarsResult<File> {\n    File::open(path).map_err(|err| _limit_path_len_io_err(path, err))\n}\n\npub fn open_file_write(path: &Path) -> PolarsResult<File> {\n    std::fs::OpenOptions::new()\n        .write(true)\n        .create(true)\n        .truncate(true)\n        .open(path)\n        .map_err(|err| _limit_path_len_io_err(path, err))\n}\n\npub fn create_file(path: &Path) -> PolarsResult<File> {\n    File::create(path).map_err(|err| _limit_path_len_io_err(path, err))\n}","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/crates/polars-utils/src/io.rs#L1-L33","documentation":"Error forwarded by _limit_path_len_io_err when wrapping an io::Error from a failed file operation (e.g. open_file). The message embeds the underlying OS error and the file path; when the path exceeds 88 chars and POLARS_VERBOSE is off, the path is truncated to its last 88 characters to keep messages readable.","triggerScenarios":"A filesystem operation on {path} failed with the underlying OS error {err}.","commonSituations":"See trigger scenarios.","solutions":["Fix the underlying I/O error for the given path: check the file exists, permissions are correct, and the disk is not full."],"exampleFix":"import os; assert os.path.exists(path)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}