wtfutil/wtf · error
%s
Error message
%s
What it means
Raised in getExistingChecks when the updown.io API returns a non-200 status: the error is only the HTTP status string (e.g. '401 Unauthorized'). Typical causes are an invalid X-API-KEY, exceeded rate limits, or updown.io service errors while listing existing checks.
Source
Thrown at modules/updown/widget.go:186
// See: https://updown.io/api#rest
u, err := makeURL(apiURLBase, "/api/checks")
if err != nil {
return nil, err
}
req, err := http.NewRequest("GET", u, http.NoBody)
if err != nil {
return nil, err
}
req.Header.Set("User-Agent", userAgent)
req.Header.Set("X-API-KEY", widget.settings.apiKey)
resp, err := http.DefaultClient.Do(req)
if err != nil {
return nil, err
}
if resp.StatusCode != 200 {
return nil, fmt.Errorf("%s", resp.Status)
}
defer func() { _ = resp.Body.Close() }()
var checks []Check
err = utils.ParseJSON(&checks, resp.Body)
if err != nil {
return nil, err
}
if len(widget.tokenSet) > 0 {
checks = filterChecks(checks, widget.tokenSet)
}
return checks, nil
}
View on GitHub (pinned to bb838c1ccb)
Solutions
- Verify the UPDOWN token is set and valid (test with curl -H 'X-Api-Token: ...' https://updown.io/api/v1/checks)
- Regenerate the token in the updown.io account settings if revoked
- Retry later on 5xx/429
- Confirm the widget is pointed at the current API base URL
Defensive patterns
Strategy: try-catch
Validate before calling
if apiKey == "" { return errors.New("updown API token not configured") }
tok := os.Getenv("UPDOWN_TOKEN")
if tok == "" { return errors.New("missing UPDOWN token") } Try / catch
checks, err := w.getExistingChecks()
if err != nil {
if strings.HasPrefix(err.Error(), "401") { log.Printf("updown auth failed; check token") }
else { log.Printf("updown: %v", err) }
return
} Prevention
- Store the API token in an environment variable and check it at startup
- Test the token with curl against /api/v1/checks before deploying
- Watch for 401 after rotating tokens in the updown dashboard
- Back off on 429 rather than hammering the API
When it happens
Trigger: Any non-200 from updown.io /checks: 401 for invalid/missing UPDOWN_TOKEN, 404/410 for wrong API version path, 429 for rate limits, 5xx outages.
Common situations: Missing or revoked API token in config; token belonging to another account; updown.io API version changes; transient 5xx.
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/77508e3e073bc3e9.
Report an issue: GitHub.