cube-js/cube · critical
wrong configuration for environment variable '{}' with '{}'
Error message
wrong configuration for environment variable '{}' with '{}' value: greater then max size {} What it means
After successfully parsing a numeric env var, the helper checks it against an optional configured maximum and panics if the value exceeds it. The variable parsed fine, but its value is above the allowed ceiling for that setting.
Source
Thrown at rust/cubestore/cubestore/src/config/mod.rs:1466
{
let v = match env::var(name).ok() {
None => {
return default;
}
Some(v) => v,
};
let n = match v.parse::<T>() {
Ok(n) => n,
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
)
}
};
nView on GitHub (pinned to 7d981676b3)
Solutions
- Lower the variable's value to at or below the maximum shown in the message.
- Consult the docs for that variable's supported range and pick a sane value within it.
- If you genuinely need a larger value, upgrade to a Cube Store version whose max bound supports it.
Example fix
// before CUBEJS_DB_EXPORT_BUCKET_MAX_ROWS=100000000 // after (max is 50,000,000) CUBEJS_DB_EXPORT_BUCKET_MAX_ROWS=50000000
Defensive patterns
Strategy: validation
Validate before calling
let v: usize = std::env::var("CUBEJS_WORKER_THREADS").unwrap_or_default().parse().unwrap_or(0);
const MAX: usize = 64;
if v > MAX {
panic!("CUBEJS_WORKER_THREADS={} exceeds max {}", v, MAX);
} Type guard
fn within_max(v: u64, max: u64) -> bool {
v <= max
} Try / catch
// Validate bounds before startup since the panic is fatal.
if let Ok(raw) = std::env::var(name) {
let v: u64 = raw.parse().map_err(|e| anyhow!("bad int for {}: {}", name, e))?;
ensure!(v <= max, "{}={} exceeds max {}", name, v, max);
} Prevention
- Read the documented maximum for each numeric env var before tuning.
- Clamp generated values with `.min(max)` in config automation.
- Re-validate values when upgrading — max bounds can change between versions.
When it happens
Trigger: Setting a numeric Cube Store env var to a value larger than the configured `max` bound for that option — e.g. a thread-pool size or queue length above the supported maximum.
Common situations: Aggressive tuning attempts (very high concurrency values); copying limits from a machine with more resources; values valid in older versions whose max has since been tightened.
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
- wrong configuration for environment variable '{}' with '{}'
- Value "${value}" is not valid for CUBEJS_MAX_REQUEST_SIZE. M
- The ${keyByDataSource('CUBEJS_DB_USE_SELECT_TEST_CONNECTION'
- Invalid cube-server-core options: ${error.message || error.t
- expected '0'/'1'/true/false for '{}', found '{}'
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/1981db1689d21287.
Report an issue: GitHub.