{"record":{"id":"aca0cd1ba5d4a6a7","repo":"openfaas/faas","slug":"invalid-value-for-max-idle-conns-s","errorCode":null,"errorMessage":"invalid value for max_idle_conns: %s","messagePattern":"invalid value for max_idle_conns: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gateway/types/readconfig.go","lineNumber":149,"sourceCode":"\t}\n\n\tcfg.UseBasicAuth = parseBoolValue(hasEnv.Getenv(\"basic_auth\"))\n\n\tsecretPath := hasEnv.Getenv(\"secret_mount_path\")\n\tif len(secretPath) == 0 {\n\t\tsecretPath = \"/run/secrets/\"\n\t}\n\tcfg.SecretMountPath = secretPath\n\tcfg.ScaleFromZero = parseBoolValue(hasEnv.Getenv(\"scale_from_zero\"))\n\n\tcfg.MaxIdleConns = 1024\n\tcfg.MaxIdleConnsPerHost = 1024\n\n\tmaxIdleConns := hasEnv.Getenv(\"max_idle_conns\")\n\tif len(maxIdleConns) > 0 {\n\t\tval, err := strconv.Atoi(maxIdleConns)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for max_idle_conns: %s\", maxIdleConns)\n\t\t}\n\t\tcfg.MaxIdleConns = val\n\n\t}\n\n\tmaxIdleConnsPerHost := hasEnv.Getenv(\"max_idle_conns_per_host\")\n\tif len(maxIdleConnsPerHost) > 0 {\n\t\tval, err := strconv.Atoi(maxIdleConnsPerHost)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for max_idle_conns_per_host: %s\", maxIdleConnsPerHost)\n\t\t}\n\t\tcfg.MaxIdleConnsPerHost = val\n\n\t}\n\n\tcfg.AuthProxyURL = hasEnv.Getenv(\"auth_proxy_url\")\n\tcfg.AuthProxyPassBody = parseBoolValue(hasEnv.Getenv(\"auth_proxy_pass_body\"))\n","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/openfaas/faas/blob/8d803bf9e2655aec6a60fd0e25b392839f96af95/gateway/types/readconfig.go#L131-L167","documentation":"Thrown by ReadConfig in gateway/types/readconfig.go while parsing the gateway's environment at startup. The max_idle_conns variable must be a plain base-10 integer because it is converted with strconv.Atoi; any other content aborts configuration loading, so the gateway fails to start. When the variable is unset the default of 1024 applies, so this error only occurs when an explicit malformed value was supplied.","triggerScenarios":"Deploying the gateway with max_idle_conns set to a value strconv.Atoi cannot parse: \"1024 \" (trailing space or newline), \"1,024\", \"1e3\", \"1024.0\", \"0x400\" or \"1k\" — for example via kubectl set env, a Helm value, a docker-compose environment entry, or a ConfigMap key carrying trailing whitespace.","commonSituations":"YAML block scalars in ConfigMaps injecting a trailing newline; Helm chart values quoted with units or thousand separators; values copied from documentation containing commas; CI pipelines interpolating whitespace or versions into env vars.","solutions":["Set max_idle_conns to a bare decimal integer, e.g. max_idle_conns=512, and redeploy the gateway","Remove the max_idle_conns variable to fall back to the built-in default of 1024","Inspect the deployment, ConfigMap or secret for trailing whitespace, quotes, commas or unit suffixes in the value","Add a CI/startup check that validates the variable against ^[0-9]+$ before shipping"],"exampleFix":"# before (docker-compose / helm env)\n  max_idle_conns: \"1,024\"\n\n# after\n  max_idle_conns: \"1024\"","handlingStrategy":"validation","validationCode":"# validate before deploying the gateway\nif [ -n \"$max_idle_conns\" ] && ! [[ \"$max_idle_conns\" =~ ^[0-9]+$ ]]; then\n  echo \"max_idle_conns must be an integer, got: $max_idle_conns\" >&2\n  exit 1\nfi","typeGuard":"func isBase10Int(s string) bool {\n\t_, err := strconv.Atoi(s)\n\treturn err == nil\n}","tryCatchPattern":null,"preventionTips":["Keep numeric env values unquoted and unit-free in manifests","Gate both *_conns variables in CI with a ^[0-9]+$ regex check","Omit max_idle_conns unless tuning has proven it necessary — the default is sane"],"tags":["configuration","environment-variables","go","startup"],"backgroundTag":null,"analyzedSha":"8d803bf9e2655aec6a60fd0e25b392839f96af95","analyzedAt":"2026-08-16T00:12:29.759Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}