rustfs/rustfs · error · ConfigError

Configuration validation failed: {0}

Error message

Configuration validation failed: {0}

What it means

The trusted-proxy configuration parsed field-by-field but failed overall (semantic) validation. Unlike InvalidIp or EnvParseError, which point at one malformed value, ValidationFailed is raised by the aggregate validate pass and its message names the cross-value rule that was broken.

Source

Thrown at crates/trusted-proxies/src/error/config.rs:39

pub enum ConfigError {
    /// Required environment variable is missing.
    #[error("Missing environment variable: {0}")]
    MissingEnvVar(String),

    /// Environment variable exists but could not be parsed.
    #[error("Failed to parse environment variable {0}: {1}")]
    EnvParseError(String, String),

    /// A configuration value is logically invalid.
    #[error("Invalid configuration value for {0}: {1}")]
    InvalidValue(String, String),

    /// An IP address or CIDR range is malformed.
    #[error("Invalid IP address or network: {0}")]
    InvalidIp(String),

    /// Configuration failed overall validation.
    #[error("Configuration validation failed: {0}")]
    ValidationFailed(String),

    /// Two or more configuration settings are in conflict.
    #[error("Configuration conflict: {0}")]
    Conflict(String),

    /// Error reading or parsing a configuration file.
    #[error("Config file error: {0}")]
    FileError(String),

    /// General invalid configuration error.
    #[error("Invalid config: {0}")]
    InvalidConfig(String),
}

impl From<AddrParseError> for ConfigError {
    fn from(err: AddrParseError) -> Self {
        Self::InvalidIp(err.to_string())

View on GitHub (pinned to 35af688cd9)

Solutions

  1. Read the message after 'Configuration validation failed:' — it states the exact rule that failed.
  2. Fill in or correct the settings that rule names, then re-run the loader.
  3. Add a pre-deploy config check that calls the same validation (see validationCode) so this fails in CI, not at startup.
Defensive patterns

Strategy: validation

Validate before calling

// run the crate's own validator in a pre-deploy step
if let Err(e) = trusted_proxies::config::load() {
    eprintln!("config rejected before deploy: {e}");
    std::process::exit(1);
}

Try / catch

match config::load() {
    Err(e @ ConfigError::ValidationFailed(_)) => log_and_abort(e),
    other => other,
}

Prevention

When it happens

Trigger: Calling the config loader's validate() (directly or as part of load) when parsed settings jointly violate an invariant — for example enabling proxy-chain validation while required companion settings (such as the trusted list itself) are absent or empty.

Common situations: Partial config after a deploy that added new required settings; env vars overriding a file into an inconsistent state; carrying over old config keys that no longer pass validation with new defaults.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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