{"record":{"id":"b96245dd3a244057","repo":"pola-rs/polars","slug":"failed-to-create-file-cache-data-directory-path-err","errorCode":null,"errorMessage":"failed to create file cache data directory: path = {}, err = {}","messagePattern":"failed to create file cache data directory: path = (.+?), err = (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/polars-io/src/file_cache/cache.rs","lineNumber":36,"sourceCode":"    if config::verbose() {\n        eprintln!(\"file cache prefix: {}\", prefix);\n    }\n\n    let min_ttl = Arc::new(AtomicU64::from(get_env_file_cache_ttl()));\n    let notify_ttl_updated = Arc::new(tokio::sync::Notify::new());\n\n    let metadata_dir = prefix.join(std::str::from_utf8(&[METADATA_PREFIX]).unwrap());\n    if let Err(err) = ensure_directory_init(metadata_dir.as_std_path()) {\n        panic!(\n            \"failed to create file cache metadata directory: path = {}, err = {}\",\n            metadata_dir, err\n        )\n    }\n\n    let data_dir = prefix.join(std::str::from_utf8(&[DATA_PREFIX]).unwrap());\n\n    if let Err(err) = ensure_directory_init(data_dir.as_std_path()) {\n        panic!(\n            \"failed to create file cache data directory: path = {}, err = {}\",\n            data_dir, err\n        )\n    }\n\n    Box::leak(Box::new(EvictionManager {\n        data_dir,\n        metadata_dir,\n        files_to_remove: None,\n        min_ttl: min_ttl.clone(),\n        notify_ttl_updated: notify_ttl_updated.clone(),\n    }))\n    .run_in_background();\n\n    // Safety: We have created the data and metadata directories.\n    unsafe { FileCache::new_unchecked(prefix, min_ttl, notify_ttl_updated) }\n});\n","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-io/src/file_cache/cache.rs#L18-L54","documentation":"Like the metadata directory panic, this fires when creating the file cache's data directory fails. It is a deliberate panic because the cache cannot function without the directory. Runs once via LazyLock initialization when cloud file caching is first used.","triggerScenarios":"First cloud read/write initializing FileCache; creating <prefix>/<DATA_PREFIX> fails due to permissions, read-only filesystem, path conflicts, or ENOSPC.","commonSituations":"Container images with read-only /tmp, restricted service accounts, or a stale non-directory file occupying the data dir path.","solutions":["Make the cache base directory writable (check POLARS_TEMP_DIR)","Remove any non-directory file colliding with the data dir path","Ensure sufficient disk space","Run with a user that has write access to the temp directory"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"use std::fs;\nlet base = std::env::var(\"POLARS_TEMP_DIR\").unwrap_or_else(|_| std::env::temp_dir().display().to_string());\nlet probe = format!(\"{base}/.polars-write-test\");\nfs::write(&probe, b\"x\").expect(\"cache dir not writable\");\nlet _ = fs::remove_file(&probe);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure cache base is on a writable, non-read-only mount","Remove stale non-directory files that collide with cache paths","Run cloud reads under a service account with temp-dir write access"],"tags":["filesystem","cache","permissions","panic"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}