{"record":{"id":"20ff2f7b4a8bd52b","repo":"pola-rs/polars","slug":"failed-to-encode-spill-file-for-context-id-e","errorCode":null,"errorMessage":"failed to encode spill file for '{context_id}': {e}","messagePattern":"failed to encode spill file for '(.+?)': (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-ooc/src/spill_frame.rs","lineNumber":41,"sourceCode":"        self.estimated_size()\n    }\n\n    async fn spill(&self, context_id: &str) -> Self::Spilled {\n        let mut df = self.clone();\n        let context_id = context_id.to_owned();\n\n        // Encode in the current task (on computational executor).\n        let mut buf = Vec::new();\n\n        let mut writer = IpcStreamWriter::new(&mut buf).with_compat_level(CompatLevel::newest());\n        let clvl = polars_config::config().ooc_spill_compression_level();\n        if clvl > 0 {\n            let zstd_lvl = ZstdLevel::try_new(clvl.try_into().unwrap()).unwrap();\n            writer = writer.with_compression(Some(IpcCompression::ZSTD(zstd_lvl)));\n        }\n        writer\n            .finish(&mut df)\n            .unwrap_or_else(|e| panic!(\"failed to encode spill file for '{context_id}': {e}\",));\n\n        // Do file creation / writing on tokio.\n        let file = ASYNC\n            .spawn(async move {\n                let size = buf.len() as u64;\n                let spill_file = SpillFile::new(&context_id, \"ipc\", size);\n                if BYTES_SPILLED_TO_DISK.fetch_add(size).saturating_add(size)\n                    > polars_config::config().ooc_disk_budget_bytes()\n                {\n                    spill_file.creation_aborted();\n                    polars_error::abort::polars_abort_ooc_out_of_disk();\n                }\n                match tokio::fs::write(spill_file.path(), buf).await {\n                    Ok(()) => spill_file,\n                    Err(e) => {\n                        let msg = format!(\n                            \"failed to create spill file '{}': {e}\",\n                            spill_file.path().display()","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/crates/polars-ooc/src/spill_frame.rs#L23-L59","documentation":"Panic in the OOC spill path when encoding a DataFrame to the in-memory IPC buffer fails before it can be written to disk (includes the context id and error). Typically caused by an unsupported dtype for IPC serialization.","triggerScenarios":"This panic/expect fires when execution reaches an unguarded state described by: \"failed to encode spill file for '{context_id}': {e}\". Typical triggers: unsupported dtype or feature-gated code path reached at runtime, invalid user input or environment variable value, calling API methods in the wrong order or on mismatched types, or data (lengths, offsets, ranges) violating the function's preconditions.","commonSituations":"Encountered when input data or configuration does not meet the preconditions of the throwing code path (\"failed to encode spill file for '{context_id}': {e}\"). Common cases: missing Cargo feature flags, mismatched dtypes/lengths between arrays or series, out-of-range temporal values, malformed environment variables, or operations on unsupported/complex nested types.","solutions":["Check disk space and write permissions for the spill directory; encoding the spill file failed with the reported I/O error.","Reduce memory pressure so spilling is not needed (smaller chunks, streaming engine settings)."],"exampleFix":null,"handlingStrategy":"try-catch","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-14T00:17:10.932Z"}