rustfs/rustfs · error · CacheConfigError

Invalid cache configuration: {0}

Error message

Invalid cache configuration: {0}

What it means

CacheConfigError variant of io-metrics raised when a cache configuration value is invalid — TTL ranges where min > max or default outside the range, non-positive capacities, or disabled-but-required combos. The reason is embedded; the builder fails at construction time before any cache is created, so the operator corrects the config and rebuilds.

Source

Thrown at crates/io-metrics/src/cache_config.rs:131

    pub fn with_ttl_range(mut self, min: u64, default: u64, max: u64) -> Self {
        self.min_ttl_seconds = min;
        self.default_ttl_seconds = default;
        self.max_ttl_seconds = max;
        self
    }

    /// Builder pattern: enable/disable adaptive TTL.
    pub fn with_adaptive_ttl(mut self, enabled: bool) -> Self {
        self.adaptive_ttl_enabled = enabled;
        self
    }
}

/// Cache configuration error.
#[derive(Debug, Clone, thiserror::Error)]
pub enum CacheConfigError {
    /// Invalid configuration value.
    #[error("Invalid cache configuration: {0}")]
    InvalidValue(String),
}

/// Adaptive TTL calculator.
#[derive(Debug, Clone)]
pub struct AdaptiveTTL {
    /// Cache configuration.
    config: CacheConfig,
    /// Access count threshold for hot items.
    hot_threshold: u64,
    /// Access count threshold for cold items.
    cold_threshold: u64,
    /// Time window for access counting.
    access_window: Duration,
}

impl Default for AdaptiveTTL {
    fn default() -> Self {

View on GitHub (pinned to 35af688cd9)

Solutions

  1. Adjust the cache configuration to satisfy min<=default<=max and sizing rules
  2. Validate the builder output before use
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/io-metrics/src/cache_config.rs:131 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rustfs/rustfs@35af688cd9 (2026-08-20). Data as JSON: /api/errors/f638ce8b8a689504. Report an issue: GitHub.