wtfutil/wtf · error
%s
Error message
%s
What it means
travisBuildRequest wraps Travis CI API calls and enforces a 2xx status; anything outside 200-299 is rejected with the raw resp.Status string. Callers (BuildsFor) then fail with that status text, e.g. "404 Not Found" or "403 Forbidden".
Source
Thrown at modules/travisci/client.go:74
if err != nil {
return nil, err
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Travis-API-Version", "3")
bearer := fmt.Sprintf("token %s", settings.apiKey)
req.Header.Add("Authorization", bearer)
httpClient := &http.Client{}
resp, err := httpClient.Do(req)
if err != nil {
return nil, err
}
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode < 200 || resp.StatusCode > 299 {
return nil, fmt.Errorf("%s", resp.Status)
}
return resp, nil
}
View on GitHub (pinned to bb838c1ccb)
Solutions
- Check the status string: 404 usually means org-vs-com host mismatch — verify the configured API URL
- Regenerate the Travis CI API token if you get 403
- Confirm the repository slug matches the current GitHub repo name
- Retry later for 429/5xx; Travis may be degraded
Example fix
// before apiURL: "https://api.travis-ci.org/repo/my-org/my-repo/builds" // repo moved to .com // after apiURL: "https://api.travis-ci.com/repo/my-org/my-repo/builds"
Defensive patterns
Strategy: retry
Validate before calling
if repoSlug == "" || strings.Count(repoSlug, "%2F") == 0 && !strings.Contains(repoSlug, "/") { return errors.New("repo slug must be owner%2Fname") } Type guard
func isAuthError(status string) bool { return strings.HasPrefix(status, "403") || strings.HasPrefix(status, "401") } Try / catch
builds, err := t.BuildsFor()
if err != nil {
if strings.HasPrefix(err.Error(), "404") { switchAPIHost(orgToCom) }
else if strings.HasPrefix(err.Error(), "403") { refreshToken() }
else { log.Printf("travis: %v", err) }
} Prevention
- Confirm the repo lives on travis-ci.com (org is shut down for most repos)
- Regenerate the API token periodically and store it in env, not config files
- Keep the repo slug in sync with GitHub renames
- Use exponential backoff for 429/5xx responses
When it happens
Trigger: Any Travis API endpoint returning 300+: 403 when the token is missing/expired/insufficient, 404 for wrong repo slug or wrong API host (org vs com), 429 rate limiting, 5xx Travis outages.
Common situations: Travis CI .org vs .com migration (repo lives on the other host); expired TRAVIS_TOKEN; repository renamed or transferred so the slug is stale; open-source repos moved off travis-ci.org after its shutdown.
Related errors
- executing request: %w
- unexpected status %d from DEV.to API
- %s
- %s
- yfinance: unexpected status %d for symbol %q
AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03).
Data as JSON: /api/errors/3c930ca4ea1ea036.
Report an issue: GitHub.