nautechsystems/nautilus_trader · error · anyhow::Error

Negative maximum value {max} for column '{column_name}'

Error message

Negative maximum value {max} for column '{column_name}'

What it means

Same function as the minimum variant: after collecting Int64 statistics across row groups, the maximum value is converted to u64. A negative maximum cannot fit in u64, so u64::try_from fails and this error is thrown.

Source

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

                        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`
/// - HTTP/WebDAV: `http://` or `https://`
/// - Local files: `file://path` or plain paths
///

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Verify the column contains only non-negative values before using this API
  2. Handle the error and query the column with signed arithmetic instead
  3. Re-model the data as unsigned (e.g. store magnitude separately) if negatives are expected
  4. Check that the correct column name is being queried (a negative-filled column may indicate a naming mistake)

Example fix

// before
let (min, max) = min_max_from_parquet_metadata(&meta, column)?;
// after
let (min, max) = min_max_from_parquet_metadata(&meta, column)
    .map_err(|e| e.context(format!("cannot read unsigned stats for '{column}'")))?;
Defensive patterns

Strategy: validation

Validate before calling

let stats_max: i64 = /* max statistic */;
anyhow::ensure!(stats_max >= 0, "column '{}' max is negative", column_name);

Type guard

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

Try / catch

let (min, max) = min_max_from_parquet_metadata(&meta, column)
    .with_context(|| format!("reading unsigned stats for '{column}'"))?;

Prevention

When it happens

Trigger: Calling min_max_from_parquet_metadata on a column where the maximum Int64 statistic is negative — meaning every value in the column is negative.

Common situations: Persisting all-negative signed columns (e.g. drawdowns, offsets) and then querying them through this unsigned min/max API.

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/2b7e53c25d344a75. Report an issue: GitHub.