{"record":{"id":"80911cc9d68148a8","repo":"cube-js/cube","slug":"wrong-configuration-for-environment-variable","errorCode":null,"errorMessage":"wrong configuration for environment variable '{}' with '{}' value: greater then max size {}","messagePattern":"wrong configuration for environment variable '(.+?)' with '(.+?)' value: greater then max size (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubesql/cubesql/src/config/mod.rs","lineNumber":483,"sourceCode":"{\n    let v = match env::var(name).ok() {\n        None => {\n            return default;\n        }\n        Some(v) => v,\n    };\n\n    let n = match v.parse::<T>() {\n        Ok(n) => n,\n        Err(e) => panic!(\n            \"could not parse environment variable '{}' with '{}' value: {}\",\n            name, v, e\n        ),\n    };\n\n    if let Some(max) = max {\n        if n > max {\n            panic!(\n                \"wrong configuration for environment variable '{}' with '{}' value: greater then max size {}\",\n                name, v,\n                max\n            )\n        }\n    };\n\n    if let Some(min) = min {\n        if n < min {\n            panic!(\n                \"wrong configuration for environment variable '{}' with '{}' value: lower then min size {}\",\n                name, v,\n                min\n            )\n        }\n    };\n\n    n","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubesql/cubesql/src/config/mod.rs#L465-L501","documentation":"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.","triggerScenarios":"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).","commonSituations":"Copy-pasting example configs with extreme values; a typo like 864000 instead of 86400 seconds; container orchestration templates injecting unbounded values.","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"],"exampleFix":"// before\nCUBESQL_META_TRANSPORT_REQUEST_TIMEOUT=99999999s\n// after\nCUBESQL_META_TRANSPORT_REQUEST_TIMEOUT=300s","handlingStrategy":"validation","validationCode":"fn validate_duration_env(name: &str, max_secs: i64) -> Result<(), String> {\n    match std::env::var(name) {\n        Ok(v) => match env_parse_duration_str(&v) {\n            Ok(n) if n <= max_secs => Ok(()),\n            Ok(n) => Err(format!(\"{}={} exceeds max {}s\", name, n, max_secs)),\n            Err(e) => Err(format!(\"{} unparseable: {}\", name, e)),\n        },\n        Err(_) => Ok(()),\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["rust","configuration","env-var","panic"],"backgroundTag":"invalid-env-var-value","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}