{"record":{"id":"0f21ee378f1ed003","repo":"jeessy2/ddns-go","slug":"v-0f21ee","errorCode":null,"errorMessage":"读取响应失败: %v","messagePattern":"读取响应失败: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dns/tnethk.go","lineNumber":279,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"创建请求失败: %v\", err)\n\t}\n\n\t// 设置请求头\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\t// 发送请求\n\tclient := t.httpClient\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"请求失败: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// 读取响应\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"读取响应失败: %v\", err)\n\t}\n\n\t// 检查HTTP状态码\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"API请求失败，状态码: %d, 响应: %s\", resp.StatusCode, string(body))\n\t}\n\n\treturn body, nil\n}\n","sourceCodeStart":261,"sourceCodeEnd":289,"githubUrl":"https://github.com/jeessy2/ddns-go/blob/5874c2e6667c69357ab95079421131104bd3fcae/dns/tnethk.go#L261-L289","documentation":"This error is thrown by the Tnet.hk DNS provider's internal request() helper in dns/tnethk.go:279 when io.ReadAll(resp.Body) fails after a successful HTTP round-trip to https://www.tnet.hk. The API call itself connected, but the response body could not be read — typically a mid-stream connection reset, timeout, or truncated response. It propagates out of create, modify and getRecordList as the returned error.","triggerScenarios":"Any signed request to the Tnet.hk API (record create, modify, or list) where the server closes/resets the connection partway through the response, the 30s client timeout fires while reading the body, or a proxy/NAT truncates the stream.","commonSituations":"Unstable network or VPN to tnet.hk; server-side gateway timeouts returning partial bodies; corporate middleboxes killing keep-alive connections; transient outages of the Tnet API.","solutions":["Retry the request — the failure is almost always transient network/stream related","Check connectivity/stability to https://www.tnet.hk (curl the same endpoint) and any proxy in between","Increase or verify the http.Client timeout used by the Tnethk provider","Check Tnet.hk API status; a server dropping connections mid-response is on their side"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Go: verify reachability before provider calls\nresp, err := http.Get(\"https://www.tnet.hk\")\nif err != nil {\n    log.Fatalf(\"tnet.hk unreachable: %v\", err)\n}\nresp.Body.Close()","typeGuard":null,"tryCatchPattern":"// Go\nfor i := 0; i < 3; i++ {\n    records, err := provider.GetRecordList(domain)\n    if err == nil {\n        break\n    }\n    if strings.Contains(err.Error(), \"读取响应失败\") {\n        time.Sleep(time.Duration(1<<i) * time.Second) // backoff and retry\n        continue\n    }\n    return err // non-transient\n}","preventionTips":["Retry idempotent reads (getRecordList) with exponential backoff","Run on a stable network path to tnet.hk; avoid flaky proxies/VPNs for API traffic","Monitor DNS provider API reachability from the host running the tool","Set a http.Client timeout generous enough for slow Tnet responses"],"tags":["network","http","io","dns-provider"],"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"}