AdguardTeam/AdGuardHome · warning
got status code %d, want %d
Error message
got status code %d, want %d
What it means
The version-check endpoint returned a non-200 status code; the actual and expected (200) codes are in the message.
Source
Thrown at internal/updater/check.go:66
return u.prevCheckResult, u.prevCheckError
}
vcu := u.versionCheckURL
req, err := http.NewRequestWithContext(ctx, http.MethodGet, vcu, nil)
if err != nil {
return VersionInfo{}, fmt.Errorf("constructing request to %s: %w", vcu, err)
}
u.logger.DebugContext(ctx, "requesting version data", "url", vcu)
resp, err := u.client.Do(req)
if err != nil {
return VersionInfo{}, fmt.Errorf("sending http request to %s: %w", vcu, err)
}
defer func() { err = errors.WithDeferred(err, resp.Body.Close()) }()
if resp.StatusCode != http.StatusOK {
return VersionInfo{}, fmt.Errorf(
"got status code %d, want %d",
resp.StatusCode,
http.StatusOK,
)
}
r := ioutil.LimitReader(resp.Body, maxVersionRespSize.Bytes())
// This use of ReadAll is safe, because we just limited the appropriate
// ReadCloser.
body, err := io.ReadAll(r)
if err != nil {
return VersionInfo{}, fmt.Errorf("reading response from %s: %w", vcu, err)
}
u.prevCheckTime = now
u.prevCheckResult, u.prevCheckError = u.parseVersionResponse(ctx, body)
View on GitHub (pinned to b41aefbe51)
Solutions
- Fetch the URL manually and inspect the status/body
- Correct the configured URL or server-side hosting of version.json
- Retry later for transient 5xx/429 responses
Defensive patterns
Strategy: retry
Validate before calling
resp, err := http.Get(checkURL)
if err == nil && resp.StatusCode != 200 { /* endpoint misconfigured; fix server */ } Try / catch
info, err := u.VersionInfo(ctx)
if err != nil && strings.Contains(err.Error(), "status code") { /* treat as server-side, retry later */ } Prevention
- Health-check version.json with 200 in CI
- Retry with backoff on 5xx
When it happens
Trigger: VersionInfo receiving 404/403/5xx/etc. from the version-check URL — e.g. moved/missing version.json, rate limiting, or a captive portal intercepting the request.
Common situations: Update server endpoint changed, CDN/auth in front returning 403, corporate proxies returning error pages, temporary 503s.
Related errors
- constructing request to %s: %w
- sending http request to %s: %w
- reading response from %s: %w
- parsing json time: %w
- json time is nil
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/954c107319dc5753.
Report an issue: GitHub.