{"record":{"id":"65b4c205b0ed18be","repo":"fish2018/pansou","slug":"v-65b4c2","errorCode":null,"errorMessage":"创建请求失败: %v","messagePattern":"创建请求失败: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/panta/panta.go","lineNumber":248,"sourceCode":"\treturn p.AsyncSearchWithResult(keyword, p.doSearch, p.MainCacheKey, ext)\n}\n\n// doSearch 执行具体的搜索逻辑\nfunc (p *PantaAsyncPlugin) doSearch(client *http.Client, keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {\n\t// 对关键词进行URL编码\n\tencodedKeyword := url.QueryEscape(keyword)\n\t\n\t// 构建搜索URL\n\tsearchURL := fmt.Sprintf(searchURLTemplate, encodedKeyword)\n\t\n\t// 创建一个带有超时的上下文\n\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(defaultTimeout)*time.Second)\n\tdefer cancel()\n\t\n\t// 创建请求\n\treq, err := http.NewRequestWithContext(ctx, \"GET\", searchURL, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"创建请求失败: %v\", err)\n\t}\n\t\n\t// 设置User-Agent和Referer\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(\"Referer\", \"https://www.91panta.cn/index\")\n\treq.Header.Set(\"Accept\", \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\")\n\treq.Header.Set(\"Accept-Language\", \"zh-CN,zh;q=0.9,en;q=0.8\")\n\treq.Header.Set(\"Connection\", \"keep-alive\")\n\treq.Header.Set(\"Upgrade-Insecure-Requests\", \"1\")\n\treq.Header.Set(\"Cache-Control\", \"max-age=0\")\n\t\n\t// 使用带重试的请求方法发送HTTP请求\n\tresp, err := p.doRequestWithRetry(req, client)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"请求PanTa搜索页面失败: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\t","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/panta/panta.go#L230-L266","documentation":"Wrapped construction error in PantaAsyncPlugin.doSearch (plugin/panta/panta.go:248): http.NewRequestWithContext failed for the panta search URL (bad URL or expired context) before any request was sent.","triggerScenarios":"Thrown at plugin/panta/panta.go:248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["校验 searchURLTemplate 与编码结果","对 encodedKeyword 做合法性检查","补充构造失败日志"],"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"}