fish2018/pansou · error

执行搜索失败

Error message

执行搜索失败: %w

What it means

Wrapped stage failure in XysPlugin.searchImpl (plugin/xys/xys.go:113): the executeSearch step (which runs after the token was successfully obtained) failed; the underlying error is wrapped, meaning token acquisition succeeded but the search request/parse did not.

Solutions

  1. Inspect the executeSearch cause
  2. Retry — the token may be reusable, avoiding a re-fetch
  3. Update response parsing if the API changed
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at plugin/xys/xys.go:113 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at plugin/xys/xys.go:113

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

	// 第一步:获取token
	token, err := p.getToken(client, keyword)
	if err != nil {
		return nil, fmt.Errorf("获取token失败: %w", err)
	}

	if p.debugMode {
		log.Printf("[XYS] 获取到token: %s", token[:10]+"...")
	}

	// 第二步:执行搜索
	results, err := p.executeSearch(client, token, keyword)
	if err != nil {
		return nil, fmt.Errorf("执行搜索失败: %w", err)
	}

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

	return results, nil
}

// getToken 获取搜索token
func (p *XysPlugin) getToken(client *http.Client, keyword string) (string, error) {
	// 检查缓存
	cacheKey := "token"
	if cached, found := p.tokenCache.Load(cacheKey); found {
		if tokenCache, ok := cached.(TokenCache); ok {
			// 检查是否过期
			if time.Since(tokenCache.Timestamp) < p.cacheTTL {
				if p.debugMode {

View on GitHub (pinned to beaa561337)