cube-js/cube · error
wrong configuration for environment variable '{}' with '{}'
Error message
wrong configuration for environment variable '{}' with '{}' value: greater then max size {} What it means
env_parse_duration parses a duration-valued environment variable (e.g. with env_parse_duration("SOME_TIMEOUT", "60s", Some(min), Some(max))). If the parsed duration exceeds the caller-provided maximum, CubeSQL panics at startup with this message. It is a deliberate fail-fast guard against nonsensical configuration values.
Source
Thrown at rust/cubesql/cubesql/src/config/mod.rs:483
{
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 value of the environment variable so it is within the allowed maximum
- Check the call site of env_parse_duration for the variable to learn the exact max bound
- Use a unit suffix correctly (s/m/h) so the value does not unintentionally inflate
Example fix
// before CUBESQL_META_TRANSPORT_REQUEST_TIMEOUT=99999999s // after CUBESQL_META_TRANSPORT_REQUEST_TIMEOUT=300s
Defensive patterns
Strategy: validation
Validate before calling
fn validate_duration_env(name: &str, max_secs: i64) -> Result<(), String> {
match std::env::var(name) {
Ok(v) => match env_parse_duration_str(&v) {
Ok(n) if n <= max_secs => Ok(()),
Ok(n) => Err(format!("{}={} exceeds max {}s", name, n, max_secs)),
Err(e) => Err(format!("{} unparseable: {}", name, e)),
},
Err(_) => Ok(()),
}
} Prevention
- Check the max bound at the env_parse_duration call site before tuning values
- Keep duration values near documented defaults
- Validate your full env file with a lint script before deploy
When it happens
Trigger: Setting a duration env variable consumed via env_parse_duration to a value larger than the configured max (e.g. a keep-alive or timeout variable set to '999999d' or a number of seconds above the allowed cap).
Common situations: Copy-pasting example configs with extreme values; a typo like 864000 instead of 86400 seconds; container orchestration templates injecting unbounded values.
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 '{}'
- Could not parse environment variable '{}' with '{}' value: {
- CUBESQL_CUBE_TOKEN is a required ENV variable
- CUBESQL_CUBE_URL is a required ENV variable
- Unrecognized log level: {}
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/80911cc9d68148a8.
Report an issue: GitHub.