hashicorp/terraform · error

retry timeout and got an error: %#v

Error message

retry timeout and got an error: %#v

What it means

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.

Source

Thrown at internal/backend/remote-state/oss/backend.go:551

}

func (a *Invoker) AddCatcher(catcher Catcher) {
	a.catchers = append(a.catchers, &catcher)
}

func (a *Invoker) Run(f func() error) error {
	err := f()

	if err == nil {
		return nil
	}

	for _, catcher := range a.catchers {
		if strings.Contains(err.Error(), catcher.Reason) {
			catcher.RetryCount--

			if catcher.RetryCount <= 0 {
				return fmt.Errorf("retry timeout and got an error: %#v", err)
			} else {
				time.Sleep(time.Duration(catcher.RetryWaitSeconds) * time.Second)
				return a.Run(f)
			}
		}
	}
	return err
}

var providerConfig map[string]interface{}

func getConfigFromProfile(d *schema.ResourceData, ProfileKey string) (interface{}, error) {

	if providerConfig == nil {
		if v, ok := d.GetOk("profile"); !ok || v.(string) == "" {
			return nil, nil
		}
		current := d.Get("profile").(string)

View on GitHub (pinned to c9def3e214)

Solutions

  1. Inspect the wrapped %#v error for the root cause and address it (throttling -> reduce concurrency; auth -> rotate creds).
  2. Retry the terraform operation after the transient condition clears (the budget is small, ~30s).
  3. If recurring, increase RetryCount via AddCatcher in your own backend wrapper or reduce parallelism.
  4. Check Alibaba Cloud status page for ongoing OSS/STS incidents.

Example fix

// before: default catchers retry 10x then surface the timeout
NewInvoker().Run(func() error { return ossOp() })

// after: extend the retry budget for known-flaky windows
i := NewInvoker()
i.AddCatcher(Catcher{"AliyunGoClientFailure", 30, 3})
i.Run(func() error { return ossOp() })
Defensive patterns

Strategy: retry

Try / catch

if err := NewInvoker().Run(func() error { return op() }); err != nil {
    if strings.Contains(err.Error(), "retry timeout") {
        // back off longer and retry the whole sequence once
        time.Sleep(30 * time.Second)
        return NewInvoker().Run(func() error { return op() })
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Related errors


AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07). Data as JSON: /api/errors/7225f75e16c79164. Report an issue: GitHub.