{"record":{"id":"8e49be5a7a6ece53","repo":"fish2018/pansou","slug":"s-w-8e49be","errorCode":null,"errorMessage":"[%s] 获取搜索结果失败: %w","messagePattern":"\\[(.+?)\\] 获取搜索结果失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/xdpan/xdpan.go","lineNumber":74,"sourceCode":"\n// SearchWithResult 执行搜索并返回包含IsFinal标记的结果\nfunc (p *XdpanPlugin) SearchWithResult(keyword string, ext map[string]interface{}) (model.PluginSearchResult, error) {\n\treturn p.AsyncSearchWithResult(keyword, p.searchImpl, p.MainCacheKey, ext)\n}\n\n// searchImpl 实现搜索逻辑\nfunc (p *XdpanPlugin) searchImpl(client *http.Client, keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {\n\tif DebugLog {\n\t\tfmt.Printf(\"[xdpan] 开始搜索: keyword=%s\\n\", keyword)\n\t}\n\n\t// Step 1: 获取搜索结果页面\n\tsearchResults, err := p.fetchSearchResults(client, keyword)\n\tif err != nil {\n\t\tif DebugLog {\n\t\t\tfmt.Printf(\"[xdpan] 获取搜索结果失败: %v\\n\", err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"[%s] 获取搜索结果失败: %w\", p.Name(), err)\n\t}\n\tif DebugLog {\n\t\tfmt.Printf(\"[xdpan] 获取搜索结果成功: 结果数=%d\\n\", len(searchResults))\n\t}\n\n\t// Step 2: 并发获取详情页信息（获取真实的百度网盘链接）\n\tp.enrichWithDetailInfo(client, searchResults)\n\tsearchResults = filterResultsWithLinks(searchResults)\n\n\t// Step 3: 关键词过滤\n\tfilteredResults := plugin.FilterResultsByKeyword(searchResults, keyword)\n\tif DebugLog {\n\t\tfmt.Printf(\"[xdpan] 关键词过滤后: 过滤前=%d, 过滤后=%d\\n\", len(searchResults), len(filteredResults))\n\t}\n\n\treturn filteredResults, nil\n}\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/xdpan/xdpan.go#L56-L92","documentation":"xdpan's searchImpl wraps any error from fetchSearchResults with the plugin name prefix: '[xdpan] 获取搜索结果失败: %w'. It is a top-level aggregation point — the root cause is one of the wrapped errors inside fetchSearchResults (request creation, transport failure, non-200 status, Cloudflare challenge, or HTML parse failure).","triggerScenarios":"Any failure in fetchSearchResults during a xdpan search: malformed search URL, network/DNS/timeout on the GET, non-200 response, 'Just a moment...' Cloudflare challenge page, or goquery parse error. searchImpl then re-wraps with the plugin name.","commonSituations":"The xdpan site is behind Cloudflare and serving browser verification to datacenter IPs; the site is down or moved; keyword contains characters that break the query string; rate limiting after frequent searches.","solutions":["Unwrap the chained error (%w) to find the root cause and fix that specific failure first.","If the root cause is the Cloudflare challenge, wait, change network/IP, or update cookies before retrying.","Check the configured baseURL is reachable (curl the /search?page=1&k=... endpoint directly).","Retry with backoff for transient network/5xx root causes."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"results, err := pluginSearch(keyword)\nif err != nil {\n\t// unwrap the chain to reach the root cause\n\troot := err\n\tfor errors.Unwrap(root) != nil { root = errors.Unwrap(root) }\n\tlog.Printf(\"xdpan search root cause: %v\", root)\n}","preventionTips":["Always inspect the wrapped root cause, not the top-level message.","Detect the Cloudflare 'Just a moment...' condition early and back off.","Keep the baseURL configuration validated and current."],"tags":["network","http","wrapper-error","cloudflare"],"backgroundTag":"api-request-failed","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"}