{"record":{"id":"b557ed96498f00e6","repo":"AdguardTeam/AdGuardHome","slug":"reading-response-from-s-w","errorCode":null,"errorMessage":"reading response from %s: %w","messagePattern":"reading response from (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/updater/check.go","lineNumber":79,"sourceCode":"\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\n\treturn u.prevCheckResult, u.prevCheckError\n}\n\n// parseVersionResponse parses version-related data and unmarshals it into the\n// [VersionInfo] structure.\nfunc (u *Updater) parseVersionResponse(\n\tctx context.Context,\n\tdata []byte,\n) (vi VersionInfo, err error) {\n\tinfo := VersionInfo{\n\t\tCanAutoUpdate: aghalg.NBFalse,\n\t}\n\tversionJSON := map[string]string{","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/updater/check.go#L61-L97","documentation":"Reading the version-check response body (limited to maxVersionRespSize via LimitReader) failed; wrapped with the URL.","triggerScenarios":"VersionInfo where the connection drops mid-response, context is cancelled during read, or the server closes the body prematurely.","commonSituations":"Flaky networks, proxies resetting long responses, or a caller's context timing out before the body finishes.","solutions":["Retry the version check with backoff","Check for proxies/MTU issues truncating responses","Ensure the caller's context deadline accommodates the full response"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"info, err := u.VersionInfo(ctx)\nif err != nil && strings.Contains(err.Error(), \"reading response\") { info, err = u.VersionInfo(ctx) }","preventionTips":["Allow generous context deadlines","Retry idempotent update checks"],"tags":["updater","http","network"],"backgroundTag":"http-response-read-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}