{"record":{"id":"c35c1db6491405b3","repo":"fish2018/pansou","slug":"w-c35c1d","errorCode":null,"errorMessage":"创建初始请求失败: %w","messagePattern":"创建初始请求失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/panwiki/panwiki.go","lineNumber":164,"sourceCode":"\tif p.debugMode {\n\t\tlog.Printf(\"[Panwiki] 关键词过滤完成，过滤前: %d，过滤后: %d\", len(allResults), len(filteredResults))\n\t\tfor i, result := range filteredResults {\n\t\t\tlog.Printf(\"[Panwiki] 最终结果%d: MessageID=%s, UniqueID=%s, 标题=%s, 链接数=%d\", i+1, result.MessageID, result.UniqueID, result.Title, len(result.Links))\n\t\t}\n\t\tlog.Printf(\"[Panwiki] 🚀 插件返回结果总数: %d\", len(filteredResults))\n\t}\n\n\treturn filteredResults, nil\n}\n\n// searchPage 搜索指定页面\nfunc (p *PanwikiPlugin) searchPage(client *http.Client, keyword string, page int) ([]model.SearchResult, error) {\n\t// Step 1: 发起初始搜索请求获取重定向URL\n\tinitialURL := p.getSearchURL(keyword, page)\n\t\n\treq, err := http.NewRequest(\"GET\", initialURL, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"创建初始请求失败: %w\", err)\n\t}\n\t\n\tp.setRequestHeaders(req)\n\t\n\t// 不自动跟随重定向\n\tclient.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\treturn http.ErrUseLastResponse\n\t}\n\t\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\t// 如果主域名失败，尝试切换到备用域名\n\t\tif p.currentBaseURL == PrimaryBaseURL {\n\t\t\tif p.debugMode {\n\t\t\t\tlog.Printf(\"[Panwiki] 主域名请求失败，尝试备用域名: %v\", err)\n\t\t\t}\n\t\t\tp.switchToBackupDomain()\n\t\t\t","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/panwiki/panwiki.go#L146-L182","documentation":"Returned by searchPage when http.NewRequest (or the initial search request construction for the first page fetch) fails. It fires before any network I/O: the cause is a malformed or unparseable initial URL built from the keyword, or an invalid method/ctx combination, so the per-page scrape never starts.","triggerScenarios":"Thrown at plugin/panwiki/panwiki.go:164 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["校验 currentBaseURL 与 URL 拼接结果","对关键词做 QueryEscape 转义","补充构造失败日志"],"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"}