{"record":{"id":"954c107319dc5753","repo":"AdguardTeam/AdGuardHome","slug":"got-status-code-d-want-d-954c10","errorCode":null,"errorMessage":"got status code %d, want %d","messagePattern":"got status code (.+?), want (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/updater/check.go","lineNumber":66,"sourceCode":"\t\treturn u.prevCheckResult, u.prevCheckError\n\t}\n\n\tvcu := u.versionCheckURL\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, vcu, nil)\n\tif err != nil {\n\t\treturn VersionInfo{}, fmt.Errorf(\"constructing request to %s: %w\", vcu, err)\n\t}\n\n\tu.logger.DebugContext(ctx, \"requesting version data\", \"url\", vcu)\n\n\tresp, err := u.client.Do(req)\n\tif err != nil {\n\t\treturn VersionInfo{}, fmt.Errorf(\"sending http request to %s: %w\", vcu, err)\n\t}\n\tdefer func() { err = errors.WithDeferred(err, resp.Body.Close()) }()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn VersionInfo{}, fmt.Errorf(\n\t\t\t\"got status code %d, want %d\",\n\t\t\tresp.StatusCode,\n\t\t\thttp.StatusOK,\n\t\t)\n\t}\n\n\tr := ioutil.LimitReader(resp.Body, maxVersionRespSize.Bytes())\n\n\t// This use of ReadAll is safe, because we just limited the appropriate\n\t// ReadCloser.\n\tbody, err := io.ReadAll(r)\n\tif err != nil {\n\t\treturn VersionInfo{}, fmt.Errorf(\"reading response from %s: %w\", vcu, err)\n\t}\n\n\tu.prevCheckTime = now\n\tu.prevCheckResult, u.prevCheckError = u.parseVersionResponse(ctx, body)\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/updater/check.go#L48-L84","documentation":"The version-check endpoint returned a non-200 status code; the actual and expected (200) codes are in the message.","triggerScenarios":"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.","commonSituations":"Update server endpoint changed, CDN/auth in front returning 403, corporate proxies returning error pages, temporary 503s.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"resp, err := http.Get(checkURL)\nif err == nil && resp.StatusCode != 200 { /* endpoint misconfigured; fix server */ }","typeGuard":null,"tryCatchPattern":"info, err := u.VersionInfo(ctx)\nif err != nil && strings.Contains(err.Error(), \"status code\") { /* treat as server-side, retry later */ }","preventionTips":["Health-check version.json with 200 in CI","Retry with backoff on 5xx"],"tags":["updater","http","status-code"],"backgroundTag":"http-unexpected-status","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}