{"record":{"id":"f09618e54fad1b4b","repo":"openfaas/faas","slug":"invalid-value-for-max-idle-conns-per-host-s","errorCode":null,"errorMessage":"invalid value for max_idle_conns_per_host: %s","messagePattern":"invalid value for max_idle_conns_per_host: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gateway/types/readconfig.go","lineNumber":159,"sourceCode":"\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\n\tcfg.Namespace = hasEnv.Getenv(\"function_namespace\")\n\n\treturn &cfg, nil\n}\n\n// GatewayConfig provides config for the API Gateway server process\ntype GatewayConfig struct {\n\n\t// HTTP timeout for reading a request from clients.\n\tReadTimeout time.Duration","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/openfaas/faas/blob/8d803bf9e2655aec6a60fd0e25b392839f96af95/gateway/types/readconfig.go#L141-L177","documentation":"Thrown by ReadConfig in gateway/types/readconfig.go at startup when the max_idle_conns_per_host environment variable is set but is not a plain base-10 integer (strconv.Atoi fails). ReadConfig returns the error and the gateway process fails to boot. Leaving the variable unset is safe: the default of 1024 applies.","triggerScenarios":"Setting max_idle_conns_per_host to a non-integer value such as \"256 \" with trailing whitespace, \"1,024\", \"0.5\", \"1e2\" or \"per-host\" via kubectl, Helm values, docker-compose environment or a ConfigMap entry with a stray newline.","commonSituations":"Copying a documented example with a comma separator; ConfigMap block scalars adding trailing newlines; CI templating injecting whitespace; confusing the variable with a memory-size style value like \"256Mi\".","solutions":["Set max_idle_conns_per_host to a bare decimal integer, e.g. max_idle_conns_per_host=256","Remove the variable to fall back to the default of 1024","Check the manifest/ConfigMap for whitespace, commas or unit suffixes in the value","Validate both *_conns variables against ^[0-9]+$ in CI"],"exampleFix":"# before\n  max_idle_conns_per_host: \"256Mi\"\n\n# after\n  max_idle_conns_per_host: \"256\"","handlingStrategy":"validation","validationCode":"# validate before deploying the gateway\nif [ -n \"$max_idle_conns_per_host\" ] && ! [[ \"$max_idle_conns_per_host\" =~ ^[0-9]+$ ]]; then\n  echo \"max_idle_conns_per_host must be an integer, got: $max_idle_conns_per_host\" >&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":["Never use memory-size suffixes (Mi, k) on connection-count variables","Render and inspect the final env with kubectl describe pod before rollout","Add schema validation for gateway env vars in Helm values tests"],"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"}