fish2018/pansou · warning

[ ] 未找到相关结果

Error message

[%s] 未找到相关结果

What it means

Empty-result guard in yiove searchImpl: the search HTTP call succeeded but returned zero threads. Distinct from a transport error — the site answered and simply had no matches (or rendered none parseable) for the keyword.

Solutions

  1. Try a broader or alternative keyword to confirm the term exists on the site
  2. Open the search URL in a browser and verify results are publicly visible (not login-gated)
  3. If the site was redesigned, update fetchSearchResults' HTML selectors to the new layout
  4. Treat this as an expected empty state in the caller rather than retrying

Example fix

// before
results, err := plugin.Search(ctx, keyword)
if err != nil { return err }
// after
results, err := plugin.Search(ctx, keyword)
if err != nil {
    if strings.Contains(err.Error(), "未找到相关结果") {
        return nil // graceful empty state
    }
    return err
}
Defensive patterns

Strategy: fallback

Validate before calling

// cannot pre-validate; guard after the call
if err != nil && strings.Contains(err.Error(), "未找到相关结果") { /* empty state */ }

Type guard

func isEmptyResultsErr(err error) bool { return err != nil && strings.Contains(err.Error(), "未找到相关结果") }

Try / catch

results, err := plugin.Search(ctx, keyword)
if isEmptyResultsErr(err) {
    return []Result{}, nil // graceful empty state, maybe try another plugin
}
if err != nil { return err }

Prevention

When it happens

Trigger: fetchSearchResults successfully parses the search page but returns 0 threads — keyword has no matches, results are behind a login/permission wall, or the page HTML changed so the parser matches nothing.

Common situations: Very niche or misspelled keywords; forum requires login to see results; site redesign breaks the extraction selectors so all results are silently dropped; keyword filtered out by the forum's own search rules.

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/97a66bc745f45a17. Report an issue: GitHub.

Appendix: source

Thrown at plugin/yiove/yiove.go:128

		}
	}

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

	logDebug(debug, "[%s] 开始搜索,关键词=%s", p.Name(), searchKeyword)

	threads, err := p.fetchSearchResults(client, searchKeyword, debug)
	if err != nil {
		logDebug(debug, "[%s] 搜索阶段报错: %v", p.Name(), err)
		return nil, err
	}
	logDebug(debug, "[%s] 搜索结果数量=%d", p.Name(), len(threads))
	if len(threads) == 0 {
		logDebug(debug, "[%s] 搜索结果为空", p.Name())
		return nil, fmt.Errorf("[%s] 未找到相关结果", p.Name())
	}

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

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

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

View on GitHub (pinned to beaa561337)