{"record":{"id":"983bb71ba08fe10d","repo":"jeessy2/ddns-go","slug":"dnsla-d-s-983bb7","errorCode":null,"errorMessage":"dnsla 记录列表请求失败，状态码: %d, 响应: %s","messagePattern":"dnsla 记录列表请求失败，状态码: (.+?), 响应: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dns/dnsla.go","lineNumber":282,"sourceCode":"\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":264,"sourceCodeEnd":286,"githubUrl":"https://github.com/jeessy2/ddns-go/blob/5874c2e6667c69357ab95079421131104bd3fcae/dns/dnsla.go#L264-L286","documentation":"This error is returned when the dnsla record-list API responds with a non-200 HTTP status code. The message includes the status code and the raw response body, which typically contains dnsla's JSON error describing why the request was rejected (auth failure, invalid domain, rate limiting, etc.). The request itself succeeded at the transport level but the API rejected it.","triggerScenarios":"resp.StatusCode != http.StatusOK: 401/403 from invalid or expired API ID/Secret (Basic auth token), 404 from wrong endpoint, 429 rate limiting, 5xx server errors, or 400 from a malformed domain name parameter.","commonSituations":"Wrong dnsla API ID or Secret (token is built as base64(ID:Secret) — a typo yields 401); the domain being managed doesn't exist in the dnsla account; API key revoked or account expired; hitting rate limits during bulk record updates across many domains.","solutions":["Read the response body in the error message — dnsla's JSON explains the rejection reason","For 401/403, verify the DNS ID and Secret configured for the dnsla provider are correct and active","For 429, reduce request concurrency or add retry with exponential backoff","For 404, confirm the endpoint URL matches the current dnsla API version","For 5xx, retry later; check dnsla service status"],"exampleFix":"// before\nif resp.StatusCode != http.StatusOK {\n    return nil, fmt.Errorf(\"dnsla 记录列表请求失败，状态码: %d, 响应: %s\", resp.StatusCode, string(result))\n}\n// after\nif resp.StatusCode != http.StatusOK {\n    if resp.StatusCode == http.StatusUnauthorized {\n        return nil, fmt.Errorf(\"dnsla 认证失败 (401)，请检查 DNS ID 和 Secret: %s\", string(result))\n    }\n    return nil, fmt.Errorf(\"dnsla 记录列表请求失败，状态码: %d, 响应: %s\", resp.StatusCode, string(result))\n}","handlingStrategy":"try-catch","validationCode":"// 发送前校验 dnsla 凭据非空\nif dnsla.DNS.ID == \"\" || dnsla.DNS.Secret == \"\" {\n    return fmt.Errorf(\"dnsla DNS ID 或 Secret 未配置\")\n}","typeGuard":"type APIStatusError struct {\n    StatusCode int\n    Body       string\n}\nfunc asStatusError(err error) (*APIStatusError, bool) {\n    var se *APIStatusError\n    if errors.As(err, &se) {\n        return se, true\n    }\n    return nil, false\n}","tryCatchPattern":"records, err := getRecordList(...)\nif err != nil {\n    if strings.Contains(err.Error(), \"状态码: 401\") || strings.Contains(err.Error(), \"状态码: 403\") {\n        return fmt.Errorf(\"dnsla 认证失败，请检查 DNS ID/Secret: %w\", err)\n    }\n    if strings.Contains(err.Error(), \"状态码: 429\") {\n        return retryWithBackoff()\n    }\n    return err\n}","preventionTips":["Double-check the dnsla API ID and Secret before running bulk updates","Keep pageSize requests modest and space out bulk operations to avoid 429","Log the response body on non-200 to capture dnsla's own error message","Monitor for dnsla API version/endpoint changes"],"tags":["http","api-error","authentication","dnsla","status-code"],"backgroundTag":"api-non-200-response","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"}