{"record":{"id":"48ef5848055ede47","repo":"jeessy2/ddns-go","slug":"dnsla-w-48ef58","errorCode":null,"errorMessage":"请求 dnsla 记录列表失败: %w","messagePattern":"请求 dnsla 记录列表失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dns/dnsla.go","lineNumber":272,"sourceCode":"\tparams.Set(\"pageIndex\", \"1\")\n\tparams.Set(\"pageSize\", \"999\")\n\n\turl := recordList + \"?\" + params.Encode()\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"创建 dnsla 记录列表请求失败: %w\", err)\n\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":254,"sourceCodeEnd":286,"githubUrl":"https://github.com/jeessy2/ddns-go/blob/5874c2e6667c69357ab95079421131104bd3fcae/dns/dnsla.go#L254-L286","documentation":"This error is returned when the HTTP client fails to execute the GET request to the dnsla record-list API, e.g. DNS resolution failure, connection refused/timeout, or TLS errors. It wraps the underlying net/http error so the root cause is available via errors.Unwrap. It means the request never reached dnsla or no response was received.","triggerScenarios":"client.Do(req) returns an error: network unreachable, dnsla API host down, DNS lookup failure for the API host, connection timeout, proxy misconfigured in environment (HTTP_PROXY/HTTPS_PROXY), or TLS certificate problems.","commonSituations":"No internet or firewall blocking outbound HTTPS; corporate proxy requiring auth not configured; dnsla API outage; Go TLS trust store issues in minimal Docker images (missing ca-certificates); IPv6-only environment where the API host has no AAAA record.","solutions":["Check the wrapped error (errors.Unwrap / %v of err) to identify timeout vs DNS vs TLS cause","Verify basic connectivity: curl https://api.dnsla.com (or the configured endpoint) from the same host","Check proxy environment variables (HTTP_PROXY/HTTPS_PROXY/NO_PROXY) if behind a corporate network","In minimal containers, install/refresh CA certificates (e.g. apk add ca-certificates)","Add a retry with backoff for transient network errors"],"exampleFix":"// before\nresp, err := client.Do(req)\nif err != nil {\n    return nil, fmt.Errorf(\"请求 dnsla 记录列表失败: %w\", err)\n}\n// after\nresp, err := client.Do(req)\nif err != nil {\n    var netErr net.Error\n    if errors.As(err, &netErr) && netErr.Timeout() {\n        return nil, fmt.Errorf(\"请求 dnsla 记录列表超时: %w\", err)\n    }\n    return nil, fmt.Errorf(\"请求 dnsla 记录列表失败: %w\", err)\n}","handlingStrategy":"retry","validationCode":"// 预检网络连通性\nconn, err := net.DialTimeout(\"tcp\", \"api.dnsla.com:443\", 3*time.Second)\nif err != nil {\n    return fmt.Errorf(\"无法连接 dnsla API: %w\", err)\n}\nconn.Close()","typeGuard":"func isTimeoutErr(err error) bool {\n    var netErr net.Error\n    return errors.As(err, &netErr) && netErr.Timeout()\n}","tryCatchPattern":"records, err := getRecordList(...)\nif err != nil {\n    var netErr net.Error\n    if errors.As(err, &netErr) && netErr.Timeout() {\n        // 退避重试\n        time.Sleep(backoff)\n        retry()\n    }\n    return fmt.Errorf(\"网络错误，无法请求 dnsla: %w\", err)\n}","preventionTips":["Configure a reasonable http.Client Timeout instead of the zero-value default","Ensure outbound HTTPS (443) is allowed and corporate proxies are configured","Install CA certificates in minimal container images","Wrap provider calls in bounded retry with exponential backoff"],"tags":["network","http","dnsla","connectivity"],"backgroundTag":"network-request-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"}