{"record":{"id":"d7198981926023f3","repo":"pola-rs/polars","slug":"invalid-value-v-for-polars-ignore-file-cache-allocate-error","errorCode":null,"errorMessage":"invalid value {v} for POLARS_IGNORE_FILE_CACHE_ALLOCATE_ERROR","messagePattern":"invalid value (.+?) for POLARS_IGNORE_FILE_CACHE_ALLOCATE_ERROR","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-io/src/file_cache/entry.rs","lineNumber":171,"sourceCode":"        let _ = std::fs::remove_file(data_file_path);\n        if !self.file_fetcher.fetches_as_symlink() {\n            let file = std::fs::OpenOptions::new()\n                .write(true)\n                .create(true)\n                .truncate(true)\n                .open(data_file_path)\n                .map_err(PolarsError::from)?;\n\n            // * Some(true)   => always raise\n            // * Some(false)  => never raise\n            // * None         => do not raise if fallocate() is not permitted, otherwise raise.\n            static RAISE_ALLOC_ERROR: LazyLock<Option<bool>> = LazyLock::new(|| {\n                let v = match std::env::var(\"POLARS_IGNORE_FILE_CACHE_ALLOCATE_ERROR\").as_deref() {\n                    Ok(\"1\") => Some(false),\n                    Ok(\"0\") => Some(true),\n                    Err(_) => None,\n                    Ok(v) => {\n                        panic!(\"invalid value {v} for POLARS_IGNORE_FILE_CACHE_ALLOCATE_ERROR\")\n                    },\n                };\n                if config::verbose() {\n                    eprintln!(\"[file_cache]: RAISE_ALLOC_ERROR: {v:?}\");\n                }\n                v\n            });\n\n            // Initialize it to get the verbose print\n            let raise_alloc_err = *RAISE_ALLOC_ERROR;\n\n            file.lock().unwrap();\n            if let Err(e) = file.allocate(remote_metadata.size) {\n                let msg = format!(\n                    \"failed to reserve {} bytes on disk to download uri = {}: {:?}\",\n                    remote_metadata.size, self.uri, e\n                );\n","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-io/src/file_cache/entry.rs#L153-L189","documentation":"POLARS_IGNORE_FILE_CACHE_ALLOCATE_ERROR only accepts '0' or '1'; any other non-empty value panics. The flag decides whether fallocate errors during cache file creation are ignored. The check runs once inside a LazyLock during try_open_check_latest.","triggerScenarios":"Setting POLARS_IGNORE_FILE_CACHE_ALLOCATE_ERROR to anything other than '0' or '1' (e.g. 'true', 'false', 'yes') and then opening a cached cloud file (try_open_assume_latest path).","commonSituations":"Developers using boolean-ish words like 'true'/'false' which the parser rejects; only the literal strings '0' and '1' are valid.","solutions":["Set the variable to '1' (ignore allocate errors) or '0' (raise them)","Unset the variable entirely for the default behavior","Audit shell profiles/CI config for accidental values like 'true'"],"exampleFix":"// before\nPOLARS_IGNORE_FILE_CACHE_ALLOCATE_ERROR=true\n// after\nPOLARS_IGNORE_FILE_CACHE_ALLOCATE_ERROR=1","handlingStrategy":"validation","validationCode":"if let Ok(v) = std::env::var(\"POLARS_IGNORE_FILE_CACHE_ALLOCATE_ERROR\") {\n    assert!(v == \"0\" || v == \"1\", \"POLARS_IGNORE_FILE_CACHE_ALLOCATE_ERROR must be '0' or '1', got: {v}\");\n}","typeGuard":"fn is_valid_alloc_flag(v: &str) -> bool {\n    v == \"0\" || v == \"1\"\n}","tryCatchPattern":null,"preventionTips":["Use only literal '0' or '1', never 'true'/'false'","Unset the variable for default behavior","Add env-var linting to deployment scripts"],"tags":["env-var","cache","configuration","panic"],"backgroundTag":"invalid-env-var-value","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"}