{"record":{"id":"16f38529d4805600","repo":"fish2018/pansou","slug":"w-16f385","errorCode":null,"errorMessage":"创建备用域名请求失败: %w","messagePattern":"创建备用域名请求失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/panwiki/panwiki.go","lineNumber":187,"sourceCode":"\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\n\t\t\t// 重新构建URL并重试\n\t\t\tinitialURL = p.getSearchURL(keyword, page)\n\t\t\treq, err = http.NewRequest(\"GET\", initialURL, nil)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"创建备用域名请求失败: %w\", err)\n\t\t\t}\n\t\t\tp.setRequestHeaders(req)\n\t\t\t\n\t\t\tresp, err = client.Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"备用域名请求也失败: %w\", err)\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"初始请求失败: %w\", err)\n\t\t}\n\t}\n\tdefer resp.Body.Close()\n\t\n\t// 重置重定向策略\n\tclient.CheckRedirect = nil\n\t\n\t// 获取重定向URL\n\tlocation := resp.Header.Get(\"Location\")","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/panwiki/panwiki.go#L169-L205","documentation":"Fallback-path error in PanwikiPlugin.searchPage (plugin/panwiki/panwiki.go:187): after the primary domain request failed, the client was switched to the backup domain, but constructing the retry request for the backup domain failed. The domain switch happened; the rebuild itself is what broke.","triggerScenarios":"Thrown at plugin/panwiki/panwiki.go:187 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["校验 BackupBaseURL 常量格式","对备用 URL 做预检验证","域名切换失败时回退返回原始错误"],"exampleFix":null,"handlingStrategy":"fallback","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"}