fish2018/pansou · error

[ ] 执行搜索失败

Error message

[%s] 执行搜索失败: %w

What it means

hdmoli's searchImpl wraps any failure from executeSearch (request creation, HTTP failure, non-200 status, HTML parse error) with 执行搜索失败. It is a top-level aggregation error meaning the HDMOLI search pipeline failed before results could be returned; the wrapped error carries the root cause.

Solutions

  1. Inspect the wrapped %w cause to identify the actual failure layer
  2. Check network connectivity and whether hdmoli is reachable (curl the BaseURL)
  3. Update the search URL/selectors if the site's structure changed
  4. Rely on doRequestWithRetry: increase maxRetries or backoff for flaky upstream

Example fix

// before
results, err := plugin.Search(keyword)
if err != nil {
    return err
}
// after
results, err := plugin.Search(keyword)
if err != nil {
    log.Printf("hdmoli search failed: %v", err) // read wrapped cause
    return nil // degrade gracefully, let other plugins answer
}
Defensive patterns

Strategy: retry

Validate before calling

// Go: pre-check upstream reachability before searching
resp, err := http.Head(BaseURL)
if err != nil || resp.StatusCode >= 500 {
    return fmt.Errorf("hdmoli unreachable, skipping search")
}

Try / catch

results, err := plugin.Search(keyword)
if err != nil {
    log.Printf("hdmoli search failed: %v", err) // inspect wrapped cause
    results = nil // degrade gracefully, other plugins may still answer
}

Prevention

When it happens

Trigger: Any call to the plugin's Search that results in executeSearch returning an error: network failure, DNS failure, timeout, non-200 response, or unparseable HTML from hdmoli's search endpoint.

Common situations: The hdmoli site is down or blocked (GFW/ISP), the search URL structure changed, rate limiting returns non-200 pages, or the machine has no internet access.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at plugin/hdmoli/hdmoli.go:86

func (p *HdmoliPlugin) Description() string {
	return Description
}

// Search 搜索接口
func (p *HdmoliPlugin) Search(keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {
	return p.searchImpl(&http.Client{Timeout: 30 * time.Second}, keyword, ext)
}

// searchImpl 搜索实现
func (p *HdmoliPlugin) searchImpl(client *http.Client, keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {
	if p.debugMode {
		log.Printf("[HDMOLI] 开始搜索: %s", keyword)
	}

	// 第一步:执行搜索获取结果列表
	searchResults, err := p.executeSearch(client, keyword)
	if err != nil {
		return nil, fmt.Errorf("[%s] 执行搜索失败: %w", p.Name(), err)
	}

	if p.debugMode {
		log.Printf("[HDMOLI] 搜索获取到 %d 个结果", len(searchResults))
	}

	// 第二步:并发获取详情页链接
	finalResults := p.fetchDetailLinks(client, searchResults, keyword)

	if p.debugMode {
		log.Printf("[HDMOLI] 最终获取到 %d 个有效结果", len(finalResults))
	}

	// 第三步:关键词过滤(标准网盘插件需要过滤)
	filteredResults := plugin.FilterResultsByKeyword(finalResults, keyword)

	if p.debugMode {
		log.Printf("[HDMOLI] 关键词过滤后剩余 %d 个结果", len(filteredResults))

View on GitHub (pinned to beaa561337)