pola-rs/polars · critical
failed to read spill file
Error message
failed to read spill file {:?}: {e} What it means
Panics in SpilledFrame::unspill when IpcStreamReader::finish fails reading a spill file that opened successfully. The Arrow IPC stream inside the spill file is corrupt, truncated, or was written by an incompatible version.
Solutions
- Verify free disk space during spill; a full disk during write causes truncated spill files
- Rerun the query; the spilled data is unrecoverable
- Use the same Polars version across all nodes of the cluster
- Check storage health if corruption recurs
Defensive patterns
Strategy: retry
Try / catch
std::panic::catch_unwind(|| rerun_query()); // corrupt spill data is unrecoverable; rerun the whole query
Prevention
- Reserve enough disk headroom (never let spill phase hit ENOSPC)
- Pin the same polars version across all cluster nodes
- Avoid killing queries mid-spill; use checkpoints
When it happens
Trigger: Reading back spilled data when the file was truncated (disk full during spill), partially written due to a crash, or the Arrow IPC format changed between Polars versions.
Common situations: Out-of-space errors during the spill phase silently truncating data; mixing Polars versions in a distributed setup; corruption on flaky storage; interrupting a query between spill and unspill.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- could not read
- Expecting to be able to downcast into bytes from read…
- failed to create spill file
- failed to encode spill file for
- failed to flush the schema file
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/389a09f1916bc606.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-ooc/src/spill_frame.rs:79
spill_file.creation_aborted();
panic!("{msg}")
},
}
})
.await
.unwrap();
Arc::new(file)
}
async fn unspill(location: &Self::Spilled) -> Self {
let path = location.path().to_owned();
ASYNC
.spawn_blocking(move || {
let file = std::fs::File::open(&path).unwrap_or_else(|e| {
panic!("failed to open spill file {:?}: {e}", path.display())
});
IpcStreamReader::new(file).finish().unwrap_or_else(|e| {
panic!("failed to read spill file {:?}: {e}", path.display())
})
})
.await
.unwrap()
}
}
#[derive(Clone)]
pub struct SpillFrame {
token: SpillToken<DataFrame>,
height: usize,
}
impl AsRef<SpillToken<DataFrame>> for SpillFrame {
fn as_ref(&self) -> &SpillToken<DataFrame> {
&self.token
}
}View on GitHub (pinned to fe841f959e)