nautechsystems/nautilus_trader · error · anyhow::Error

Negative minimum value {min} for column '{column_name}'

Error message

Negative minimum value {min} for column '{column_name}'

What it means

min_max_from_parquet_metadata_object_store reads Int64 min/max statistics from Parquet metadata and returns them as an unsigned (u64) pair. When the minimum statistic is negative it cannot be represented as u64, so the conversion fails and this anyhow error is thrown.

Source

Thrown at crates/persistence/src/parquet.rs:465

                            overall_max_value = Some(max_value);
                        }
                    } else {
                        anyhow::bail!("Warning: Column name '{column_name}' is not of type i64.");
                    }
                } else {
                    anyhow::bail!(
                        "Warning: Statistics not available for column '{column_name}' in row group {i}."
                    );
                }
            }
        }
    }

    // Return the min/max pair if both are available
    if let (Some(min), Some(max)) = (overall_min_value, overall_max_value) {
        Ok((
            u64::try_from(min).map_err(|_| {
                anyhow::anyhow!("Negative minimum value {min} for column '{column_name}'")
            })?,
            u64::try_from(max).map_err(|_| {
                anyhow::anyhow!("Negative maximum value {max} for column '{column_name}'")
            })?,
        ))
    } else {
        anyhow::bail!(
            "Column '{column_name}' not found or has no Int64 statistics in any row group."
        )
    }
}

/// Creates an object store from a URI string with optional storage options.
///
/// Supports multiple cloud storage providers:
/// - AWS S3: `s3://bucket/path`
/// - Google Cloud Storage: `gs://bucket/path` or `gcs://bucket/path`
/// - Azure Blob Storage: `az://account/container/path` or `abfs://container@account.dfs.core.windows.net/path`

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Ensure the queried column stores only non-negative Int64 values before calling the function
  2. Catch the error and fall back to a signed scan of the column data instead of statistics
  3. Inspect the Parquet metadata with pyarrow/parquet-tools to confirm the column's min statistic before use
  4. If the column legitimately needs negatives, this API does not support it; use a different retrieval path

Example fix

// before
let (min, max) = min_max_from_parquet_metadata(&meta, "pnl")?;
// after
match min_max_from_parquet_metadata(&meta, "pnl") {
    Ok((min, max)) => (min, max),
    Err(e) if e.to_string().contains("Negative minimum value") =>
        return Err(anyhow::anyhow!("column 'pnl' holds signed data; use signed statistics API")),
    Err(e) => return Err(e),
}
Defensive patterns

Strategy: validation

Validate before calling

// rust: check statistics sign before calling
let stats_min = /* i64 min from metadata */;
anyhow::ensure!(stats_min >= 0, "column '{}' has negative min; unsigned API unsupported", column_name);
let (min, max) = min_max_from_parquet_metadata(&meta, column_name)?;

Type guard

fn is_non_negative_i64(v: i64) -> bool { v >= 0 }

Try / catch

match min_max_from_parquet_metadata(&meta, column) {
    Ok(pair) => pair,
    Err(e) => { warn!("min/max unavailable for {column}: {e}"); fallback_scan(column) }
}

Prevention

When it happens

Trigger: Calling min_max_from_parquet_metadata / min_max_from_parquet_metadata_object_store on a Parquet file whose Int64 column statistics contain a negative minimum (e.g. signed deltas, PnL-like or negative-timestamp columns).

Common situations: Pointing the persistence layer at a catalog/data column that stores signed values; assuming all persisted Int64 columns are non-negative (timestamps, sequence numbers); stale or hand-crafted Parquet files written by other tooling.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/fa73b37332ff8f5b. Report an issue: GitHub.