{"record":{"id":"d54674dbbb015754","repo":"fish2018/pansou","slug":"s-session-w","errorCode":null,"errorMessage":"[%s] 创建session客户端失败: %w","messagePattern":"\\[(.+?)\\] 创建session客户端失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/qupanshe/qupanshe.go","lineNumber":66,"sourceCode":"\t}\n\treturn result.Results, nil\n}\n\n// SearchWithResult 执行搜索并返回包含IsFinal标记的结果\nfunc (p *QupanshePlugin) 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 *QupanshePlugin) searchImpl(client *http.Client, keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {\n\tif DebugLog {\n\t\tfmt.Printf(\"[qupanshe] 开始搜索: keyword=%s\\n\", keyword)\n\t}\n\n\t// 创建带有Cookie管理的专用客户端，确保整个搜索过程使用同一个session\n\tsessionClient, err := p.createSessionClient(client)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] 创建session客户端失败: %w\", p.Name(), err)\n\t}\n\n\tif DebugLog {\n\t\tfmt.Printf(\"[qupanshe] 创建session客户端成功，开始三步搜索流程\\n\")\n\t}\n\n\t// Step 1: 获取首页formhash（使用session客户端）\n\tformhash, err := p.getFormhash(sessionClient)\n\tif err != nil {\n\t\tif DebugLog {\n\t\t\tfmt.Printf(\"[qupanshe] 获取formhash失败: %v\\n\", err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"[%s] 获取formhash失败: %w\", p.Name(), err)\n\t}\n\tif DebugLog {\n\t\tfmt.Printf(\"[qupanshe] 获取到formhash: %s\\n\", formhash)\n\t}\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/qupanshe/qupanshe.go#L48-L84","documentation":"searchImpl wraps any failure from createSessionClient, which builds a cookie-managed HTTP client for the qupanshe search flow. The only failure path inside createSessionClient is cookiejar.New, which fails if the underlying cookie jar implementation cannot be initialized. Wrapping with %w preserves the root cause for diagnosis.","triggerScenarios":"cookiejar.New(nil) returns an error while createSessionClient initializes the session client at the start of searchImpl. In practice this is nearly impossible on standard Go runtimes since cookiejar.New with nil Options never fails.","commonSituations":"Runtime environments with constrained crypto/rand availability or exotic platform builds; otherwise this error indicates a truly unexpected internal failure rather than user misconfiguration.","solutions":["Retry the search; the failure is transient/environmental in practice","Check the wrapped root cause (err inside %w) for platform-specific jar initialization errors","Upgrade/verify the Go runtime on the host","If reproducible, file a bug with the wrapped error message"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"results, err := plugin.Search(ctx, keyword)\nif err != nil {\n    if strings.Contains(err.Error(), \"创建session客户端失败\") {\n        // session client init failed; retry once or surface env problem\n        return retryOrFallback(err)\n    }\n    return err\n}","preventionTips":["Run on standard supported Go platforms","Don't modify cookiejar.New options without validating them","Log the wrapped cause with %w-aware errors.Is/As"],"tags":["go","http-client","cookie-jar"],"backgroundTag":"module-init-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"}