fish2018/pansou · error
获取token失败
Error message
获取token失败: %w
What it means
Wrapper at the top of xys searchImpl: the pre-search token request (getToken) failed — transport error, non-200, or token extraction failure. Without a token no search can be issued, so the whole search aborts.
Solutions
- Inspect the wrapped cause from getToken
- Retry the token fetch with backoff
- If token endpoint changed, update getToken
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at plugin/xys/xys.go:103 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/8ba7c59067215e1e.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/xys/xys.go:103
func (p *XysPlugin) Description() string {
return Description
}
// Search 搜索接口
func (p *XysPlugin) Search(keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {
return p.searchImpl(&http.Client{Timeout: 30 * time.Second}, keyword, ext)
}
// searchImpl 搜索实现
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
}View on GitHub (pinned to beaa561337)