{"record":{"id":"578d0498e6a728a5","repo":"hashicorp/terraform","slug":"failed-to-parse-address-url-s","errorCode":null,"errorMessage":"failed to parse address URL: %s","messagePattern":"failed to parse address URL: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/http/backend.go","lineNumber":133,"sourceCode":"\tbackendbase.Base\n\n\tclient *httpClient\n}\n\nfunc (b *Backend) Configure(configVal cty.Value) tfdiags.Diagnostics {\n\taddress := backendbase.GetAttrEnvDefaultFallback(\n\t\tconfigVal, \"address\",\n\t\t\"TF_HTTP_ADDRESS\", cty.StringVal(\"\"),\n\t).AsString()\n\tif address == \"\" {\n\t\treturn backendbase.ErrorAsDiagnostics(\n\t\t\tfmt.Errorf(\"address argument is required\"),\n\t\t)\n\t}\n\tupdateURL, err := url.Parse(address)\n\tif err != nil {\n\t\treturn backendbase.ErrorAsDiagnostics(\n\t\t\tfmt.Errorf(\"failed to parse address URL: %s\", err),\n\t\t)\n\t}\n\tif updateURL.Scheme != \"http\" && updateURL.Scheme != \"https\" {\n\t\treturn backendbase.ErrorAsDiagnostics(\n\t\t\tfmt.Errorf(\"address must be HTTP or HTTPS\"),\n\t\t)\n\t}\n\n\tupdateMethod := backendbase.GetAttrEnvDefaultFallback(\n\t\tconfigVal, \"update_method\",\n\t\t\"TF_HTTP_UPDATE_METHOD\", cty.StringVal(\"POST\"),\n\t).AsString()\n\n\tvar lockURL *url.URL\n\tif v := backendbase.GetAttrEnvDefault(configVal, \"lock_address\", \"TF_HTTP_LOCK_ADDRESS\"); !v.IsNull() {\n\t\tvar err error\n\t\tlockURL, err = url.Parse(v.AsString())\n\t\tif err != nil {","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote-state/http/backend.go#L115-L151","documentation":"Configure() parses the resolved address with net/url's url.Parse. Although Go's url.Parse is lenient, it returns errors for control characters, invalid escapes, or malformed URLs; such an error is wrapped here with the parse error in %s.","triggerScenarios":"address contains unescaped spaces/control chars, a backslash, unencoded query characters, or otherwise malformed syntax that url.Parse rejects. Triggered during 'terraform init'.","commonSituations":"URL pasted with spaces, an unencoded fragment/query, a Windows path-style backslash, or a value built by string concatenation that produced invalid escapes.","solutions":["URL-encode the address or fix the malformed component (e.g. replace spaces with %20, encode query params).","Validate locally: 'go run -<<' with url.Parse, or just paste into a browser to confirm it's well-formed.","Avoid building the URL by concatenation; interpolate from a known-good base + encoded path."],"exampleFix":"// before\naddress = \"https://state.example.com/state/my team.tfstate\"\n\n// after\naddress = \"https://state.example.com/state/my%20team.tfstate\"","handlingStrategy":"validation","validationCode":"import \"net/url\"\nif _, err := url.Parse(address); err != nil {\n    log.Fatalf(\"address is not a valid URL: %v\", err)\n}","typeGuard":"func isValidURL(s string) bool {\n    _, err := url.Parse(s)\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["URL-encode any spaces or special characters in the address.","Avoid building URLs via raw string concatenation of user input.","Paste-test the URL in a browser before committing it."],"tags":["http","backend","url","config-validation"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}