fish2018/pansou · warning

[ ] 未找到相关资源

Error message

[%s] 未找到相关资源

What it means

The plugin fetched and parsed the mizixing search results page but found zero result items. It treats "site reachable but no matches" as an error rather than returning an empty slice, so callers get this error for queries with no hits on the site.

Solutions

  1. Retry with broader or corrected search keywords.
  2. Verify the site still uses article.excerpt markup; update the CSS selector if it changed.
  3. Treat empty results as empty output instead of an error if desired by changing the caller.

Example fix

// before
if len(items) == 0 {
    return nil, fmt.Errorf("[%s] 未找到相关资源", p.Name())
}
// after
if len(items) == 0 {
    return plugin.FilterResultsByKeyword(nil, searchKeyword), nil
}
Defensive patterns

Strategy: fallback

Try / catch

results, err := mizixingSearch(ctx, keyword)
if err != nil && strings.Contains(err.Error(), "未找到相关资源") {
    return nil, nil // treat as no matches
}

Prevention

When it happens

Trigger: searchImpl calls fetchSearchResults successfully, but doc.Find("article.excerpt") matches nothing — query has no matches on the site, or the site's HTML layout changed.

Common situations: Obscure/typo'd search terms; site redesign removing the article.excerpt selector; bot-walls serving empty shells.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at plugin/mizixing/mizixing.go:111

	return p.AsyncSearchWithResult(keyword, p.searchImpl, p.MainCacheKey, ext)
}

func (p *MizixingPlugin) searchImpl(client *http.Client, keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {
	if p.client != nil {
		client = p.client
	}

	searchKeyword := strings.TrimSpace(keyword)
	if searchKeyword == "" {
		return nil, fmt.Errorf("[%s] 关键词不能为空", p.Name())
	}

	items, err := p.fetchSearchResults(client, searchKeyword)
	if err != nil {
		return nil, err
	}
	if len(items) == 0 {
		return nil, fmt.Errorf("[%s] 未找到相关资源", p.Name())
	}

	var (
		wg      sync.WaitGroup
		sem     = make(chan struct{}, detailWorkers)
		resultM sync.Mutex
		results []model.SearchResult
	)

	for _, item := range items {
		item := item
		wg.Add(1)
		sem <- struct{}{}

		go func() {
			defer wg.Done()
			defer func() { <-sem }()

View on GitHub (pinned to beaa561337)