{"record":{"id":"0268b5f9406872a4","repo":"pola-rs/polars","slug":"failed-to-open-spill-file-e","errorCode":null,"errorMessage":"failed to open spill file {:?}: {e}","messagePattern":"failed to open spill file (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/polars-ooc/src/spill_frame.rs","lineNumber":76,"sourceCode":"                            \"failed to create spill file '{}': {e}\",\n                            spill_file.path().display()\n                        );\n                        spill_file.creation_aborted();\n                        panic!(\"{msg}\")\n                    },\n                }\n            })\n            .await\n            .unwrap();\n        Arc::new(file)\n    }\n\n    async fn unspill(location: &Self::Spilled) -> Self {\n        let path = location.path().to_owned();\n        ASYNC\n            .spawn_blocking(move || {\n                let file = std::fs::File::open(&path).unwrap_or_else(|e| {\n                    panic!(\"failed to open spill file {:?}: {e}\", path.display())\n                });\n                IpcStreamReader::new(file).finish().unwrap_or_else(|e| {\n                    panic!(\"failed to read spill file {:?}: {e}\", path.display())\n                })\n            })\n            .await\n            .unwrap()\n    }\n}\n\n#[derive(Clone)]\npub struct SpillFrame {\n    token: SpillToken<DataFrame>,\n    height: usize,\n}\n\nimpl AsRef<SpillToken<DataFrame>> for SpillFrame {\n    fn as_ref(&self) -> &SpillToken<DataFrame> {","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-ooc/src/spill_frame.rs#L58-L94","documentation":"Panics in SpilledFrame::unspill when std::fs::File::open cannot open a previously written spill file. The spill file that was created during spill can no longer be opened, usually because it was deleted or the path became inaccessible.","triggerScenarios":"Calling unspill (reading spilled data back) when the spill file path no longer exists or cannot be opened: file cleaned up by a tmpwatch/systemd-tmpfiles job, temp dir wiped between operations, or permission revoked.","commonSituations":"Long-running lazy queries where OS temp cleaners remove old files mid-query; running stages of a pipeline in different processes/containers so the spill file is lost; k8s pod restarts with emptyDir cleaned.","solutions":["Disable or configure temp-file cleaners to keep files younger than the query duration","Point TMPDIR to a location not subject to automatic cleanup","Ensure the same filesystem/sandbox is used for spill and unspill","Restore read permissions on the spill directory for the process user"],"exampleFix":"// before\nlet file = std::fs::File::open(&path).unwrap_or_else(|e| panic!(\"failed to open spill file {:?}: {e}\", path.display()));\n// after\nlet file = match std::fs::File::open(&path) {\n    Ok(f) => f,\n    Err(e) => return Err(PolarsError::IO(format!(\"spill missing {:?}: {e}\", path.display()).into())),\n};","handlingStrategy":"validation","validationCode":"// Verify spill file still accessible before unspill\nstd::fs::metadata(&path).map_err(|e| format!(\"spill file gone: {e}\"))?;","typeGuard":null,"tryCatchPattern":"std::panic::catch_unwind(|| unspill_and_process());","preventionTips":["Exclude the spill directory from tmp cleaners (tmpwatch, systemd-tmpfiles)","Keep spill and unspill in the same container/filesystem lifetime","Use persistent scratch dirs for long-running queries"],"tags":["io","filesystem","file-not-found","panic"],"backgroundTag":"file-open-failed","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"}