cube-js/cube · error

wrong configuration for environment variable '{}' with '{}'

Error message

wrong configuration for environment variable '{}' with '{}' value: lower then min size {}

What it means

env_parse_duration parses a duration-valued environment variable and, when a minimum bound is supplied, panics if the parsed duration is smaller than that minimum. This prevents configurations that would e.g. poll too frequently or time out instantly.

Source

Thrown at rust/cubesql/cubesql/src/config/mod.rs:493

        Err(e) => panic!(
            "could not parse environment variable '{}' with '{}' value: {}",
            name, v, e
        ),
    };

    if let Some(max) = max {
        if n > max {
            panic!(
                "wrong configuration for environment variable '{}' with '{}' value: greater then max size {}",
                name, v,
                max
            )
        }
    };

    if let Some(min) = min {
        if n < min {
            panic!(
                "wrong configuration for environment variable '{}' with '{}' value: lower then min size {}",
                name, v,
                min
            )
        }
    };

    n
}

pub type LoopHandle = JoinHandle<Result<(), CubeError>>;

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Raise the value of the environment variable so it meets the minimum
  2. Check the env_parse_duration call site to learn the exact min bound
  3. Remove the variable to fall back to the default instead of forcing a tiny value

Example fix

// before
CUBESQL_META_TRANSPORT_REQUEST_TIMEOUT=0s
// after
CUBESQL_META_TRANSPORT_REQUEST_TIMEOUT=30s
Defensive patterns

Strategy: validation

Validate before calling

fn validate_duration_env_min(name: &str, min_secs: i64) -> Result<(), String> {
    match std::env::var(name) {
        Ok(v) => match env_parse_duration_str(&v) {
            Ok(n) if n >= min_secs => Ok(()),
            Ok(n) => Err(format!("{}={} below min {}s", name, n, min_secs)),
            Err(e) => Err(format!("{} unparseable: {}", name, e)),
        },
        Err(_) => Ok(()),
    }
}

Prevention

When it happens

Trigger: Setting a duration env variable consumed via env_parse_duration to a value below the configured min (e.g. '0s', '1ms', or a bare small integer) where the call site requires a larger floor.

Common situations: Disabling a feature by setting its interval to 0; typos omitting units so '100' is interpreted with a tiny unit; copying tuned prod values into constrained dev environments.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/62c36952e78951c2. Report an issue: GitHub.