{"record":{"id":"c88dbec3133a72a2","repo":"jeessy2/ddns-go","slug":"dnsla-w-c88dbe","errorCode":null,"errorMessage":"读取 dnsla 记录列表响应失败: %w","messagePattern":"读取 dnsla 记录列表响应失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dns/dnsla.go","lineNumber":279,"sourceCode":"\t}\n\n\tbyteBuff := []byte(dnsla.DNS.ID + \":\" + dnsla.DNS.Secret)\n\ttoken := \"Basic \" + base64.StdEncoding.EncodeToString(byteBuff)\n\t// 设置 Headers\n\treq.Header.Set(\"Authorization\", token)\n\n\t// 发送请求\n\tclient := dnsla.httpClient\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"请求 dnsla 记录列表失败: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// 读取响应\n\tresult, err = io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"读取 dnsla 记录列表响应失败: %w\", err)\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"dnsla 记录列表请求失败，状态码: %d, 响应: %s\", resp.StatusCode, string(result))\n\t}\n\treturn result, nil\n}\n","sourceCodeStart":261,"sourceCodeEnd":286,"githubUrl":"https://github.com/jeessy2/ddns-go/blob/5874c2e6667c69357ab95079421131104bd3fcae/dns/dnsla.go#L261-L286","documentation":"This error is returned when io.ReadAll fails while reading the dnsla API response body after a successful HTTP call. This is rare because the body is fully buffered by the client, and typically indicates the connection was reset mid-response or a custom http.Client Transport/ResponseWriter misbehaved.","triggerScenarios":"io.ReadAll(resp.Body) returns an error: server closed the connection before sending the full body, chunked encoding interrupted, or a custom http.Transport / interceptor returning an erroring body reader.","commonSituations":"Unstable network dropping long responses; dnsla API gateway cutting connections; wrapping client (e.g. debug middleware) providing a failing body; response body read after a timeout set on the client aborted mid-read.","solutions":["Retry the request — this is usually transient","Check the wrapped error message for 'connection reset' or 'unexpected EOF' to confirm mid-stream drop","Increase the http.Client Timeout if the response is large and the timeout cuts reads","Rule out proxies/load balancers terminating idle or long connections"],"exampleFix":"// before\nresult, err = io.ReadAll(resp.Body)\nif err != nil {\n    return nil, fmt.Errorf(\"读取 dnsla 记录列表响应失败: %w\", err)\n}\n// after\nresult, err = io.ReadAll(resp.Body)\nif err != nil {\n    return nil, fmt.Errorf(\"读取 dnsla 记录列表响应失败 (status=%d): %w\", resp.StatusCode, err)\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":"func isTransientIOErr(err error) bool {\n    return errors.Is(err, io.ErrUnexpectedEOF) || errors.Is(err, syscall.ECONNRESET)\n}","tryCatchPattern":"records, err := getRecordList(...)\nif err != nil {\n    if strings.Contains(err.Error(), \"unexpected EOF\") || strings.Contains(err.Error(), \"connection reset\") {\n        // 瞬时错误，重试一次\n        records, err = getRecordList(...)\n    }\n    if err != nil {\n        return err\n    }\n}","preventionTips":["Avoid reading the body from multiple goroutines concurrently","Set a client timeout long enough for large record lists (pageSize=999)","Check proxy/LB idle-timeout settings if errors recur"],"tags":["http","response-body","io","dnsla"],"backgroundTag":"response-body-read-failed","analyzedSha":"5874c2e6667c69357ab95079421131104bd3fcae","analyzedAt":"2026-09-03T15:41:16.799Z","contentChangedAt":"2026-09-03T15:41:16.799Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}