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

  1. Verify free disk space during spill; a full disk during write causes truncated spill files
  2. Rerun the query; the spilled data is unrecoverable
  3. Use the same Polars version across all nodes of the cluster
  4. 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

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


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)