{"record":{"id":"db9ad29513a79830","repo":"cube-js/cube","slug":"wrong-configuration-for-environment-variable-db9ad2","errorCode":null,"errorMessage":"wrong configuration for environment variable '{}' with '{}' value: lower then min size {}","messagePattern":"wrong configuration for environment variable '(.+?)' with '(.+?)' value: lower then min size (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust/cubestore/cubestore/src/config/mod.rs","lineNumber":1476,"sourceCode":"        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\n}\n\npub fn env_parse_size(name: &str, default: usize, max: Option<usize>, min: Option<usize>) -> usize {\n    let v = match env::var(name).ok() {\n        None => {\n            if cfg!(debug_assertions) {\n                // It's needed to check that default values are correct\n                default.to_string()\n            } else {\n                return default;","sourceCodeStart":1458,"sourceCodeEnd":1494,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/cubestore/src/config/mod.rs#L1458-L1494","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Raise the variable's value to at least the minimum shown in the message.","If you intended to disable a feature, look for a dedicated boolean env var instead of setting a numeric one to 0.","Review the docs for the variable's minimum and adjust your sizing accordingly."],"exampleFix":"// before (0 is below the minimum)\nCUBEJS_EXTERNAL_MAX_PRE_AGGREGATIONS=0\n\n// after\nCUBEJS_EXTERNAL_MAX_PRE_AGGREGATIONS=1","handlingStrategy":"validation","validationCode":"let v: usize = std::env::var(\"CUBEJS_WORKER_THREADS\").unwrap_or_default().parse().unwrap_or(0);\nconst MIN: usize = 1;\nif v < MIN {\n    panic!(\"CUBEJS_WORKER_THREADS={} is below min {}\", v, MIN);\n}","typeGuard":"fn within_min(v: u64, min: u64) -> bool {\n    v >= min\n}","tryCatchPattern":"if let Ok(raw) = std::env::var(name) {\n    let v: u64 = raw.parse().map_err(|e| anyhow!(\"bad int for {}: {}\", name, e))?;\n    ensure!(v >= min, \"{}={} is below min {}\", name, v, min);\n}","preventionTips":["Never set numeric tuning vars to 0 as a 'disable' value; find the feature's own toggle.","Record each variable's documented minimum alongside your deployment config.","Use `.max(min)` when generating values programmatically."],"tags":["configuration","environment-variables","validation","startup"],"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"}