{"record":{"id":"489f75a320d8edc3","repo":"hashicorp/terraform","slug":"invalid-retry-max-s","errorCode":null,"errorMessage":"invalid retry_max: %s","messagePattern":"invalid retry_max: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/http/backend.go","lineNumber":195,"sourceCode":"\t\t\treturn backendbase.ErrorAsDiagnostics(\n\t\t\t\tfmt.Errorf(\"unlock_address must be HTTP or HTTPS\"),\n\t\t\t)\n\t\t}\n\t}\n\tunlockMethod := backendbase.GetAttrEnvDefaultFallback(\n\t\tconfigVal, \"unlock_method\",\n\t\t\"TF_HTTP_UNLOCK_METHOD\", cty.StringVal(\"UNLOCK\"),\n\t).AsString()\n\n\tretryMax, err := backendbase.IntValue(\n\t\tbackendbase.GetAttrEnvDefaultFallback(\n\t\t\tconfigVal, \"retry_max\",\n\t\t\t\"TF_HTTP_RETRY_MAX\", cty.NumberIntVal(2),\n\t\t),\n\t)\n\tif err != nil {\n\t\treturn backendbase.ErrorAsDiagnostics(\n\t\t\tfmt.Errorf(\"invalid retry_max: %s\", err),\n\t\t)\n\t}\n\tretryWaitMin, err := backendbase.IntValue(\n\t\tbackendbase.GetAttrEnvDefaultFallback(\n\t\t\tconfigVal, \"retry_wait_min\",\n\t\t\t\"TF_HTTP_RETRY_WAIT_MIN\", cty.NumberIntVal(1),\n\t\t),\n\t)\n\tif err != nil {\n\t\treturn backendbase.ErrorAsDiagnostics(\n\t\t\tfmt.Errorf(\"invalid retry_wait_min: %s\", err),\n\t\t)\n\t}\n\tretryWaitMax, err := backendbase.IntValue(\n\t\tbackendbase.GetAttrEnvDefaultFallback(\n\t\t\tconfigVal, \"retry_wait_max\",\n\t\t\t\"TF_HTTP_RETRY_WAIT_MAX\", cty.NumberIntVal(30),\n\t\t),","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/remote-state/http/backend.go#L177-L213","documentation":"backendbase.IntValue failed to convert the retry_max value (attribute or TF_HTTP_RETRY_MAX, default 2) to a Go int. IntValue rejects fractional numbers (e.g. 2.5), NaN/Infinity, and values outside the int range. retry_max must be a whole number.","triggerScenarios":"retry_max set to a fractional number like 2.5, an extremely large number exceeding int64, or NaN/Infinity via a computed expression.","commonSituations":"User sets retry_max = 2.5 assuming floats are allowed; a variable evaluates to a float; copy from documentation that used a decimal.","solutions":["Set retry_max to a non-negative integer (e.g. retry_max = 2).","Remove the retry_max setting to fall back to the default of 2.","If sourcing from a variable, ensure its type is number and the value is integral."],"exampleFix":"// before\nretry_max = 2.5\n// after\nretry_max = 2","handlingStrategy":"validation","validationCode":"# Pre-flight: retry_max must be a non-negative integer\nif [ -n \"$TF_HTTP_RETRY_MAX\" ]; then\n  case \"$TF_HTTP_RETRY_MAX\" in\n    ''|*[!0-9]*) echo \"ERROR: retry_max must be a non-negative integer, got: $TF_HTTP_RETRY_MAX\"; exit 1 ;;\n  esac\nfi","typeGuard":"// In Go-land embedding this backend: validate the cty value is integral.\nfunc isIntegral(n cty.Value) bool {\n    if !n.IsKnown() || n.IsNull() { return false }\n    f, _ := n.AsBigFloat().Float64()\n    return n.AsBigFloat().IsInt() || f == float64(int64(f))\n}","tryCatchPattern":null,"preventionTips":["Always set retry_max to a whole number literal (retry_max = 2).","Type-tighten any variable feeding retry_max to an integer.","Leave the setting unset to accept the default of 2."],"tags":["config","validation","http-backend","retry"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}