pola-rs/polars · error

failed to create spill file '{}': {e}

Error message

failed to create spill file '{}': {e}

What it means

Panic in the OOC spill path when tokio::fs::write fails to create the spill file on disk (permissions, ENOSPC, or invalid path). The message names the file and io error; free disk space or fix the spill directory.

Source

Thrown at crates/polars-ooc/src/spill_frame.rs:62

        let file = ASYNC
            .spawn(async move {
                let size = buf.len() as u64;
                let spill_file = SpillFile::new(&context_id, "ipc", size);
                if BYTES_SPILLED_TO_DISK.fetch_add(size).saturating_add(size)
                    > polars_config::config().ooc_disk_budget_bytes()
                {
                    spill_file.creation_aborted();
                    polars_error::abort::polars_abort_ooc_out_of_disk();
                }
                match tokio::fs::write(spill_file.path(), buf).await {
                    Ok(()) => spill_file,
                    Err(e) => {
                        let msg = format!(
                            "failed to create spill file '{}': {e}",
                            spill_file.path().display()
                        );
                        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())
                })

View on GitHub (pinned to 68506541d2)

Solutions

  1. Verify the spill directory path is valid and writable; creating the spill file failed.
  2. Free disk space or point the spill directory at a volume with capacity.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: This panic/expect fires when execution reaches an unguarded state described by: "failed to create spill file '{}': {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.

Common situations: Encountered when input data or configuration does not meet the preconditions of the throwing code path ("failed to create spill file '{}': {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.


AI-assisted analysis of pola-rs/polars@68506541d2 (2026-08-19). Data as JSON: /api/errors/8acc5838fd691d2f. Report an issue: GitHub.