mislav/hub · error
%s\nGiven up after retrying for %.1f seconds.
Error message
%s\nGiven up after retrying for %.1f seconds.
What it means
When creating the pull request fails transiently (e.g. HTTP 422/5xx), gh retries with an increasing delay up to a retry limit. If the error persists after the retries are exhausted, the last error is wrapped with "Given up after retrying for N seconds." and surfaced to the user.
Source
Thrown at commands/pull_request.go:380
utils.Check(err)
} else {
retryAllowance = 9
}
}
var pr *github.PullRequest
for {
pr, err = client.CreatePullRequest(baseProject, params)
if err != nil && strings.Contains(err.Error(), `Invalid value for "head"`) {
if retryAllowance > 0 {
retryAllowance -= retryDelay
time.Sleep(time.Duration(retryDelay) * time.Second)
retryDelay++
numRetries++
} else {
if numRetries > 0 {
duration := time.Since(startedAt)
err = fmt.Errorf("%s\nGiven up after retrying for %.1f seconds.", err, duration.Seconds())
}
break
}
} else {
break
}
}
if err == nil {
defer messageBuilder.Cleanup()
}
utils.Check(err)
pullRequestURL = pr.HTMLURL
params = map[string]interface{}{}
flagPullRequestLabels := commaSeparated(args.Flag.AllValues("--labels"))View on GitHub (pinned to 5c547ed804)
Solutions
- Read the wrapped original error: if it says a PR already exists, open the existing PR instead of creating a new one.
- Wait for rate limits/outage to clear (check https://www.githubstatus.com) and retry later.
- Check network/proxy stability; rerun the command once the connection is reliable.
- Increase patience or check `gh auth status` — an invalid token can also produce persistent API failures.
Defensive patterns
Strategy: try-catch
Try / catch
err := createPullRequest(...)
if err != nil {
if strings.Contains(err.Error(), "already exists") {
// open existing PR instead
} else if strings.Contains(err.Error(), "Given up after retrying") {
// check network / API status, wait, retry later
}
} Prevention
- Check for an existing PR before creating.
- Handle rate limits and API outages before scripted runs.
- Use a stable network/auth setup (gh auth status).
When it happens
Trigger: The GitHub API call to create the PR keeps failing through all retry iterations: err != nil and (no more retries allowed), so the loop breaks after wrapping the error with the elapsed time since startedAt.
Common situations: PR already exists (422 unprocessable entity); GitHub API outage or rate limiting; slow/unreliable network causing repeated timeouts across the whole retry window.
Related errors
- stopped after 10 redirects
- Error: that fork is not available anymore
- Error: No pull request number given
- invalid pull request number: '%s'
- no open pull requests found for branch '%s'
AI-assisted analysis of mislav/hub@5c547ed804 (2026-09-01).
Data as JSON: /api/errors/3a45d7010e0d5618.
Report an issue: GitHub.