{"record":{"id":"7225f75e16c79164","repo":"hashicorp/terraform","slug":"retry-timeout-and-got-an-error-v","errorCode":null,"errorMessage":"retry timeout and got an error: %#v","messagePattern":"retry timeout and got an error: %#v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/oss/backend.go","lineNumber":551,"sourceCode":"}\n\nfunc (a *Invoker) AddCatcher(catcher Catcher) {\n\ta.catchers = append(a.catchers, &catcher)\n}\n\nfunc (a *Invoker) Run(f func() error) error {\n\terr := f()\n\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\tfor _, catcher := range a.catchers {\n\t\tif strings.Contains(err.Error(), catcher.Reason) {\n\t\t\tcatcher.RetryCount--\n\n\t\t\tif catcher.RetryCount <= 0 {\n\t\t\t\treturn fmt.Errorf(\"retry timeout and got an error: %#v\", err)\n\t\t\t} else {\n\t\t\t\ttime.Sleep(time.Duration(catcher.RetryWaitSeconds) * time.Second)\n\t\t\t\treturn a.Run(f)\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}\n\nvar providerConfig map[string]interface{}\n\nfunc getConfigFromProfile(d *schema.ResourceData, ProfileKey string) (interface{}, error) {\n\n\tif providerConfig == nil {\n\t\tif v, ok := d.GetOk(\"profile\"); !ok || v.(string) == \"\" {\n\t\t\treturn nil, nil\n\t\t}\n\t\tcurrent := d.Get(\"profile\").(string)","sourceCodeStart":533,"sourceCodeEnd":569,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote-state/oss/backend.go#L533-L569","documentation":"Returned by Invoker.Run when a retried error keeps recurring until the catcher's RetryCount (default 10 for both ClientErrorCatcher 'AliyunGoClientFailure' and ServiceBusyCatcher 'ServiceUnavailable') is exhausted. Each retry sleeps RetryWaitSeconds (3) before recursing. The %#v is the original error.","triggerScenarios":"An OSS/SDK operation whose error string contains 'AliyunGoClientFailure' or 'ServiceUnavailable' is retried up to 10 times with 3s waits (~30s total) and keeps failing. Used by the oss backend's state operations to wrap flaky SDK calls.","commonSituations":"Prolonged Alibaba Cloud service degradation; a persistent client-side bug matching the catcher reason; throttling that does not resolve within 30s; network partition lasting longer than the retry budget.","solutions":["Inspect the wrapped %#v error for the root cause and address it (throttling -> reduce concurrency; auth -> rotate creds).","Retry the terraform operation after the transient condition clears (the budget is small, ~30s).","If recurring, increase RetryCount via AddCatcher in your own backend wrapper or reduce parallelism.","Check Alibaba Cloud status page for ongoing OSS/STS incidents."],"exampleFix":"// before: default catchers retry 10x then surface the timeout\nNewInvoker().Run(func() error { return ossOp() })\n\n// after: extend the retry budget for known-flaky windows\ni := NewInvoker()\ni.AddCatcher(Catcher{\"AliyunGoClientFailure\", 30, 3})\ni.Run(func() error { return ossOp() })","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := NewInvoker().Run(func() error { return op() }); err != nil {\n    if strings.Contains(err.Error(), \"retry timeout\") {\n        // back off longer and retry the whole sequence once\n        time.Sleep(30 * time.Second)\n        return NewInvoker().Run(func() error { return op() })\n    }\n    return err\n}","preventionTips":["Reduce concurrency during known throttling windows.","Monitor Alibaba Cloud status for OSS/STS incidents.","Tune Catcher counts for your SLO budget."],"tags":["oss","retry","timeout","transient","backend"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}