fish2018/pansou · error

web search returned no document items

Error message

web search returned no document items

What it means

After parsing the panso search page, searchWeb expects to extract items matching div.search-item. If zero items are found it raises 'web search returned no document items' instead of returning an empty result. This detects silent upstream layout changes or a page that is no longer a results page.

Solutions

  1. Fetch the URL manually and diff the DOM against the div.search-item selector; update the selector.
  2. Check whether the keyword has no real results and distinguish that from a layout change before erroring.
  3. Inspect the HTML for captcha/challenge markers and handle that case explicitly.
  4. Verify the response is the search results page and not a redirect to a homepage.

Example fix

// before
if len(items) == 0 {
    return nil, fmt.Errorf("web search returned no document items")
}
// after
if len(items) == 0 {
    if doc.Find(".no-result").Length() > 0 {
        return []model.SearchResult{}, nil // genuine empty result
    }
    return nil, fmt.Errorf("web search returned no document items")
}
Defensive patterns

Strategy: validation

Validate before calling

// sanity check after parse
if doc.Find("div.search-item").Length() == 0 && doc.Find(".no-result").Length() == 0 {
    // neither results nor an empty-state marker: likely layout change or bot page
}

Try / catch

results, err := plugin.Search(keyword)
if err != nil && strings.Contains(err.Error(), "no document items") {
    // distinguish genuine empty results from broken selectors before retrying
}

Prevention

When it happens

Trigger: doc.Find("div.search-item") matched nothing in searchWeb — the page rendered but contained no results blocks, e.g. a captcha/consent page, an empty keyword result with different markup, or a CSS selector that no longer matches after a site redesign.

Common situations: panso.vip redesigned its search results DOM; search returned a 'no results' page with different structure; anti-bot interstitial served with 200; keyword genuinely has no matches.

Understand the failure class

Background: "empty response", "returned no data", "empty embeddings": what HTTP 200-with-empty-body errors mean across libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at plugin/sousou/sousou.go:212

	items := make([]pansoSearchItem, 0, 20)
	doc.Find("div.search-item").Each(func(_ int, item *goquery.Selection) {
		anchor := item.Find("a.search-item-title[href]").First()
		href := strings.TrimSpace(anchor.AttrOr("href", ""))
		if href == "" {
			return
		}
		items = append(items, pansoSearchItem{
			DocURL:   absolutePansoURL(href),
			Title:    strings.TrimSpace(anchor.Text()),
			Content:  strings.TrimSpace(item.Find(".search-item-info").Text()),
			DiskType: strings.TrimSpace(item.Find(".search-item-logo").AttrOr("alt", "")),
			Datetime: parsePansoDatetime(item.Find(".search-item-meta-item").Text()),
			Password: parsePansoPassword(item),
		})
	})
	if len(items) == 0 {
		return nil, fmt.Errorf("web search returned no document items")
	}

	results := make([]model.SearchResult, 0, len(items))
	sem := make(chan struct{}, 8)
	var wg sync.WaitGroup
	var mu sync.Mutex
	for _, item := range items {
		item := item
		wg.Add(1)
		go func() {
			defer wg.Done()
			sem <- struct{}{}
			defer func() { <-sem }()
			result, err := p.fetchPansoDocument(client, item)
			if err != nil {
				debugLog("document %s failed: %v", item.DocURL, err)
				return
			}

View on GitHub (pinned to beaa561337)