{"record":{"id":"b729ba60bb60264d","repo":"fish2018/pansou","slug":"d-b729ba","errorCode":null,"errorMessage":"状态码: %d","messagePattern":"状态码: %d","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/yulinshufa/yulinshufa.go","lineNumber":748,"sourceCode":"}\n\nfunc (p *YulinshufaPlugin) doRequestWithRetry(client *http.Client, req *http.Request, maxRetries int) (*http.Response, error) {\n\tvar lastErr error\n\tfor attempt := 0; attempt < maxRetries; attempt++ {\n\t\tif attempt > 0 {\n\t\t\tbackoff := time.Duration(1<<uint(attempt-1)) * 200 * time.Millisecond\n\t\t\ttime.Sleep(backoff)\n\t\t\tp.debugf(\"重试第 %d 次, url=%s\", attempt+1, req.URL.String())\n\t\t}\n\n\t\tresp, err := client.Do(req.Clone(req.Context()))\n\t\tif err == nil && resp.StatusCode == http.StatusOK {\n\t\t\treturn resp, nil\n\t\t}\n\n\t\tif resp != nil {\n\t\t\tresp.Body.Close()\n\t\t\tlastErr = fmt.Errorf(\"状态码: %d\", resp.StatusCode)\n\t\t} else {\n\t\t\tlastErr = err\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"请求重试 %d 次仍失败: %w\", maxRetries, lastErr)\n}\n\nfunc parseDebugFlag() bool {\n\tvalue := strings.ToLower(strings.TrimSpace(os.Getenv(\"YULINSHUFA_DEBUG\")))\n\tif value == \"\" {\n\t\treturn false\n\t}\n\treturn value == \"1\" || value == \"true\" || value == \"yes\" || value == \"on\"\n}\n\nfunc (p *YulinshufaPlugin) debugf(format string, args ...interface{}) {\n\tif p.debugMode {\n\t\tlog.Printf(\"[YULINSHUFA] \"+format, args...)","sourceCodeStart":730,"sourceCodeEnd":766,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/yulinshufa/yulinshufa.go#L730-L766","documentation":"Per-attempt status sentinel in yulinshufa doRequestWithRetry: the request returned a response but not 200, so this attempt is discarded (body closed) and lastErr is set to the code-only error; the loop retries with 200ms exponential backoff.","triggerScenarios":"Thrown at plugin/yulinshufa/yulinshufa.go:748 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Map 403/429/5xx to pacing or header fixes","Log the URL with the code for diagnosis","Give up after retries and surface the last code"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"beaa56133755a548ebc51b090b3816e2ae044aa6","analyzedAt":"2026-09-07T00:31:18.025Z","contentChangedAt":"2026-09-07T00:31:18.025Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}