cube-js/cube · critical

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

Error message

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

What it means

The numeric env-var helper also enforces an optional minimum: if the parsed value is below the configured `min` bound, startup panics with this message. The value is syntactically valid but too small for the setting.

Source

Thrown at rust/cubestore/cubestore/src/config/mod.rs:1476

        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 fn env_parse_size(name: &str, default: usize, max: Option<usize>, min: Option<usize>) -> usize {
    let v = match env::var(name).ok() {
        None => {
            if cfg!(debug_assertions) {
                // It's needed to check that default values are correct
                default.to_string()
            } else {
                return default;

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Raise the variable's value to at least the minimum shown in the message.
  2. If you intended to disable a feature, look for a dedicated boolean env var instead of setting a numeric one to 0.
  3. Review the docs for the variable's minimum and adjust your sizing accordingly.

Example fix

// before (0 is below the minimum)
CUBEJS_EXTERNAL_MAX_PRE_AGGREGATIONS=0

// after
CUBEJS_EXTERNAL_MAX_PRE_AGGREGATIONS=1
Defensive patterns

Strategy: validation

Validate before calling

let v: usize = std::env::var("CUBEJS_WORKER_THREADS").unwrap_or_default().parse().unwrap_or(0);
const MIN: usize = 1;
if v < MIN {
    panic!("CUBEJS_WORKER_THREADS={} is below min {}", v, MIN);
}

Type guard

fn within_min(v: u64, min: u64) -> bool {
    v >= min
}

Try / catch

if let Ok(raw) = std::env::var(name) {
    let v: u64 = raw.parse().map_err(|e| anyhow!("bad int for {}: {}", name, e))?;
    ensure!(v >= min, "{}={} is below min {}", name, v, min);
}

Prevention

When it happens

Trigger: Setting a numeric Cube Store env var to a value below its configured `min` bound — e.g. a timeout or buffer count of 0 where at least 1 is required.

Common situations: Setting a value to 0 intending 'disable' when the option does not accept 0; minimal-resource container configs trimming values too far; typos dropping a digit.

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