fish2018/pansou · error

[ ] 所有搜索任务都失败

Error message

[%s] 所有搜索任务都失败

What it means

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.

Solutions

  1. Check DebugLog output for the per-pan failure reasons printed during phase one.
  2. Verify haisou.cc is reachable (curl the search URL) and that headers/User-Agent are still accepted.
  3. Retry later or with fewer concurrent tasks if rate-limited.
  4. Update the search URL/response parsing if the site API changed.

Example fix

// before
results, err := plugin.Search(ctx, kw) // 所有搜索任务都失败
// after
results, err := plugin.Search(ctx, kw)
if err != nil && strings.Contains(err.Error(), "所有搜索任务都失败") {
    time.Sleep(5 * time.Second) // backoff, then retry once
    results, err = plugin.Search(ctx, kw)
}
Defensive patterns

Strategy: retry

Validate before calling

// preflight connectivity to the upstream site
resp, err := http.Head("https://haisou.cc/")
if err != nil { return fmt.Errorf("haisou.cc unreachable: %w", err) }

Type guard

func isAllTasksFailed(err error) bool { return err != nil && strings.Contains(err.Error(), "所有搜索任务都失败") }

Try / catch

results, err := plugin.Search(ctx, kw)
if isAllTasksFailed(err) {
    time.Sleep(10 * time.Second) // backoff then retry
    results, err = plugin.Search(ctx, kw)
    if err != nil { return fmt.Errorf("search unavailable: %w", err) }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07). Data as JSON: /api/errors/25a76783b5c99c64. Report an issue: GitHub.

Appendix: source

Thrown at plugin/haisou/haisou.go:198

		successTasks++
		allShareItems = append(allShareItems, pageResult.shareItems...)
		resultsByType[pageResult.cloudType] += len(pageResult.shareItems)
		if DebugLog {
			fmt.Printf("[%s] %s网盘第%d页成功获取 %d 个结果\n", p.Name(), pageResult.cloudType, pageResult.pageNo, len(pageResult.shareItems))
		}
	}

	if DebugLog {
		fmt.Printf("[%s] 搜索阶段完成: 成功%d任务, 失败%d任务, 总hsid%d个\n",
			p.Name(), successTasks, errorTasks, len(allShareItems))
		for cloudType, count := range resultsByType {
			fmt.Printf("[%s]   - %s网盘: %d个结果\n", p.Name(), cloudType, count)
		}
	}

	// 4. 如果所有搜索任务都失败,返回错误
	if successTasks == 0 {
		return nil, fmt.Errorf("[%s] 所有搜索任务都失败", p.Name())
	}

	// 5. 第二阶段:并发获取所有链接
	if DebugLog {
		fmt.Printf("[%s] 开始第二阶段:并发获取 %d 个链接\n", p.Name(), len(allShareItems))
	}

	linkResultsChan := make(chan LinkResult, len(allShareItems))
	var linkWg sync.WaitGroup

	// 启动并发链接获取任务
	for _, shareItem := range allShareItems {
		linkWg.Add(1)
		go func(item ShareItem) {
			defer linkWg.Done()

			shareURL, password, err := p.fetchShareLink(client, item.HSID, item.Platform)
			linkResultsChan <- LinkResult{

View on GitHub (pinned to beaa561337)