{"record":{"id":"25a76783b5c99c64","repo":"fish2018/pansou","slug":"s-25a767","errorCode":null,"errorMessage":"[%s] 所有搜索任务都失败","messagePattern":"\\[(.+?)\\] 所有搜索任务都失败","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/haisou/haisou.go","lineNumber":198,"sourceCode":"\t\tsuccessTasks++\n\t\tallShareItems = append(allShareItems, pageResult.shareItems...)\n\t\tresultsByType[pageResult.cloudType] += len(pageResult.shareItems)\n\t\tif DebugLog {\n\t\t\tfmt.Printf(\"[%s] %s网盘第%d页成功获取 %d 个结果\\n\", p.Name(), pageResult.cloudType, pageResult.pageNo, len(pageResult.shareItems))\n\t\t}\n\t}\n\n\tif DebugLog {\n\t\tfmt.Printf(\"[%s] 搜索阶段完成: 成功%d任务, 失败%d任务, 总hsid%d个\\n\",\n\t\t\tp.Name(), successTasks, errorTasks, len(allShareItems))\n\t\tfor cloudType, count := range resultsByType {\n\t\t\tfmt.Printf(\"[%s]   - %s网盘: %d个结果\\n\", p.Name(), cloudType, count)\n\t\t}\n\t}\n\n\t// 4. 如果所有搜索任务都失败，返回错误\n\tif successTasks == 0 {\n\t\treturn nil, fmt.Errorf(\"[%s] 所有搜索任务都失败\", p.Name())\n\t}\n\n\t// 5. 第二阶段：并发获取所有链接\n\tif DebugLog {\n\t\tfmt.Printf(\"[%s] 开始第二阶段：并发获取 %d 个链接\\n\", p.Name(), len(allShareItems))\n\t}\n\n\tlinkResultsChan := make(chan LinkResult, len(allShareItems))\n\tvar linkWg sync.WaitGroup\n\n\t// 启动并发链接获取任务\n\tfor _, shareItem := range allShareItems {\n\t\tlinkWg.Add(1)\n\t\tgo func(item ShareItem) {\n\t\t\tdefer linkWg.Done()\n\n\t\t\tshareURL, password, err := p.fetchShareLink(client, item.HSID, item.Platform)\n\t\t\tlinkResultsChan <- LinkResult{","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/haisou/haisou.go#L180-L216","documentation":"Haisou's searchImpl fans out searches to multiple pan (cloud-drive) providers concurrently and throws this error when zero tasks succeeded — every provider's search either errored or returned no usable results. It is an aggregate failure meaning no share links could be collected at all for the query.","triggerScenarios":"Calling Search when all per-pan search goroutines fail: the haisou.cc API is down/blocked, network egress fails, the API returns non-200 or non-JSON for every pan type, or the query legitimately matches nothing while tasks also fail.","commonSituations":"Site blocking the client IP or requiring new anti-bot headers; haisou.cc API endpoint changed or is offline; rate limiting all concurrent requests; DNS/proxy issues in the deployment environment.","solutions":["Check DebugLog output for the per-pan failure reasons printed during phase one.","Verify haisou.cc is reachable (curl the search URL) and that headers/User-Agent are still accepted.","Retry later or with fewer concurrent tasks if rate-limited.","Update the search URL/response parsing if the site API changed."],"exampleFix":"// before\nresults, err := plugin.Search(ctx, kw) // 所有搜索任务都失败\n// after\nresults, err := plugin.Search(ctx, kw)\nif err != nil && strings.Contains(err.Error(), \"所有搜索任务都失败\") {\n    time.Sleep(5 * time.Second) // backoff, then retry once\n    results, err = plugin.Search(ctx, kw)\n}","handlingStrategy":"retry","validationCode":"// preflight connectivity to the upstream site\nresp, err := http.Head(\"https://haisou.cc/\")\nif err != nil { return fmt.Errorf(\"haisou.cc unreachable: %w\", err) }","typeGuard":"func isAllTasksFailed(err error) bool { return err != nil && strings.Contains(err.Error(), \"所有搜索任务都失败\") }","tryCatchPattern":"results, err := plugin.Search(ctx, kw)\nif isAllTasksFailed(err) {\n    time.Sleep(10 * time.Second) // backoff then retry\n    results, err = plugin.Search(ctx, kw)\n    if err != nil { return fmt.Errorf(\"search unavailable: %w\", err) }\n}","preventionTips":["Inspect per-pan failure logs before assuming a code bug.","Check upstream availability and IP blocking before batch runs.","Throttle concurrency to avoid being rate-limited across all pan types at once.","Fall back to another search plugin/provider when this one fails wholesale."],"tags":["network","search","upstream","aggregation"],"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"}