fish2018/pansou · error
hunhepan API error
Error message
hunhepan API error: %w
What it means
The hunhepan plugin fires parallel goroutines against multiple upstream search APIs (HunhepanAPI, QkpansoAPI, KuakeAPI, MisosoAPI). When the goroutine calling p.searchAPI(client, HunhepanAPI, keyword) fails, it sends this wrapped error into errChan.
Solutions
- Log the wrapped cause (errors.Unwrap) to see if it is transport, status, or decode failure
- Verify the HunhepanAPI URL is still valid and the request payload matches the current API contract
- Retry with backoff if the failure was transient (timeout/5xx)
- Since results are aggregated from 4 APIs, treat this as partial failure and use results from the other endpoints
- Check for API changes (docs/endpoint moved) if the error persists
Example fix
// before
items, err := p.searchAPI(client, HunhepanAPI, keyword)
if err != nil {
errChan <- fmt.Errorf("hunhepan API error: %w", err)
return
}
// after
items, err := p.searchAPI(client, HunhepanAPI, keyword)
if err != nil {
log.Printf("hunhepan API error (non-fatal): %v", err) // degrade gracefully
return
}
resultChan <- items Defensive patterns
Strategy: fallback
Type guard
func isHunhepanAPIError(err error) bool {
return err != nil && strings.Contains(err.Error(), "hunhepan API error")
} Try / catch
results, err := plugin.Search(keyword)
if err != nil {
if isHunhepanAPIError(err) {
// aggregation may still return partial results from other sources
log.Printf("hunhepan source failed: %v", err)
}
return nil, err
} Prevention
- Design callers to tolerate partial multi-source results
- Monitor each upstream endpoint's health independently
- Keep endpoint URLs and payload schemas updated against upstream changes
- Rate-limit the parallel fan-out to avoid tripping upstream limits
When it happens
Trigger: p.searchAPI for the HunhepanAPI endpoint returns any error: HTTP request failure, non-2xx status, JSON decode failure, or empty/invalid response body during a keyword search.
Common situations: Hunhepan API endpoint changed or is down, API requires updated auth/cookies, request blocked by rate limiting, keyword triggers an upstream error response.
Related errors
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/3490e997b5eab54e.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/hunhepan/hunhepan.go:86
// doSearch 实际的搜索实现
func (p *HunhepanAsyncPlugin) doSearch(client *http.Client, keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {
debugLog("开始搜索,关键词: %s", keyword)
// 创建结果通道和错误通道
resultChan := make(chan []HunhepanItem, 4)
errChan := make(chan error, 4)
// 创建等待组
var wg sync.WaitGroup
wg.Add(4)
// 并行请求三个API
go func() {
defer wg.Done()
items, err := p.searchAPI(client, HunhepanAPI, keyword)
if err != nil {
errChan <- fmt.Errorf("hunhepan API error: %w", err)
return
}
resultChan <- items
}()
go func() {
defer wg.Done()
items, err := p.searchAPI(client, QkpansoAPI, keyword)
if err != nil {
errChan <- fmt.Errorf("qkpanso API error: %w", err)
return
}
resultChan <- items
}()
go func() {
defer wg.Done()
items, err := p.searchAPI(client, KuakeAPI, keyword)View on GitHub (pinned to beaa561337)