fish2018/pansou · warning

[ ] 未找到相关资源

Error message

[%s] 未找到相关资源

What it means

The Daishu plugin's searchImpl gathers results concurrently (worker goroutines with a WaitGroup) and, after wg.Wait(), checks whether the results slice is empty. If no items were parsed for the keyword, it returns this error carrying the plugin name. It is the plugin's way of signaling that the upstream site yielded zero matches rather than a transport failure.

Solutions

  1. Verify the keyword actually exists on the daishudj site by searching it manually in a browser.
  2. Check upstream HTML layout changes and update the plugin's selectors so results are parsed again.
  3. Treat the error as an expected no-match condition in the caller instead of retrying.
  4. Enable plugin debug/logging to inspect what the detail fetchers extracted.

Example fix

// before
results, err := p.Search(keyword)
if err != nil { log.Fatal(err) }
// after
results, err := p.Search(keyword)
if err != nil {
    if strings.Contains(err.Error(), "未找到相关资源") {
        results = []model.SearchResult{} // no match is not fatal
    } else {
        log.Fatal(err)
    }
}
Defensive patterns

Strategy: try-catch

Try / catch

results, err := plugin.Search(keyword)
if err != nil {
    if strings.Contains(err.Error(), "未找到相关资源") {
        return []model.SearchResult{}, nil // treat as no match
    }
    return err
}

Prevention

When it happens

Trigger: Called automatically when AsyncSearchWithResult invokes p.searchImpl and every worker finished but appended nothing to results — e.g. the keyword has no posts on the site, or the detail-fetch goroutines all discarded the post because detailURL/postID extraction produced nothing.

Common situations: Searching an obscure or very new keyword that the Daishu site has not indexed; the site changed its HTML layout so selectors silently match nothing; keyword filtering upstream removed all candidates before the plugin saw them.

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

Appendix: source

Thrown at plugin/daishudj/daishudj.go:210

				UniqueID: fmt.Sprintf("%s-%s", p.Name(), postID),
				Title:    title,
				Content:  summary,
				Links:    links,
				Tags:     tags,
				Channel:  "",
				Datetime: publish,
			}

			mu.Lock()
			results = append(results, result)
			mu.Unlock()
		}(title, detailURL, summary, postID, append([]string{}, tags...), publishTime)
	})

	wg.Wait()

	if len(results) == 0 {
		return nil, fmt.Errorf("[%s] 未找到相关资源", p.Name())
	}

	return plugin.FilterResultsByKeyword(results, keyword), nil
}

func (p *DaishuPlugin) fetchDetailLinks(client *http.Client, detailURL, postID string) []model.Link {
	if cached, ok := detailCache.Load(postID); ok {
		if entry, valid := cached.(cacheEntry); valid {
			if time.Now().Before(entry.expiresAt) && len(entry.links) > 0 {
				return entry.links
			}
			detailCache.Delete(postID)
		}
	}

	ctx, cancel := context.WithTimeout(context.Background(), detailTimeout)
	defer cancel()

View on GitHub (pinned to beaa561337)