{"record":{"id":"099b89bcd3912100","repo":"fish2018/pansou","slug":"s-api-s-099b89","errorCode":null,"errorMessage":"[%s] API返回错误状态: %s","messagePattern":"\\[(.+?)\\] API返回错误状态: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/xdyh/xdyh.go","lineNumber":168,"sourceCode":"\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"[%s] 请求返回状态码: %d\", pluginName, resp.StatusCode)\n\t}\n\t\n\t// 9. 读取响应体\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] 读取响应失败: %w\", pluginName, err)\n\t}\n\t\n\t// 10. 解析JSON响应\n\tvar apiResp APIResponse\n\tif err := json.Unmarshal(body, &apiResp); err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] JSON解析失败: %w\", pluginName, err)\n\t}\n\t\n\t// 11. 检查API响应状态\n\tif apiResp.Status != \"success\" {\n\t\treturn nil, fmt.Errorf(\"[%s] API返回错误状态: %s\", pluginName, apiResp.Status)\n\t}\n\t\n\t// 12. 转换为标准格式\n\tresults := p.convertToSearchResults(apiResp, keyword)\n\t\n\t// 13. 缓存结果\n\tif len(results) > 0 {\n\t\tsearchCache.Store(cacheKey, results)\n\t}\n\t\n\t// 14. 关键词过滤\n\treturn plugin.FilterResultsByKeyword(results, keyword), nil\n}\n\n// setRequestHeaders 设置HTTP请求头\nfunc (p *XdyhAsyncPlugin) setRequestHeaders(req *http.Request) {\n\treq.Header.Set(\"User-Agent\", \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\")\n\treq.Header.Set(\"Accept\", \"application/json, text/plain, */*\")","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/xdyh/xdyh.go#L150-L186","documentation":"Application-level rejection from xdyh: JSON decoded fine but the APIResponse.Status field is not \"success\". The transport and schema were OK; the server rejected the query (bad params, auth, or server-side failure).","triggerScenarios":"Thrown at plugin/xdyh/xdyh.go:168 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Map the status string to known failure modes","Retry only for transient statuses; otherwise correct the request"],"exampleFix":null,"handlingStrategy":"validation","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"}