fish2018/pansou · error
[ ] 执行搜索失败
Error message
[%s] 执行搜索失败: %w
What it means
searchImpl in the javdb plugin wraps any non-rate-limited failure from executeSearchWithRateLimit as '[javdb] 执行搜索失败: %w' (search execution failed). It is the top-level error aggregator for the search step; rate-limited runs (isRateLimited=true) are deliberately not wrapped because partial results are still processed.
Solutions
- Unwrap the %w cause to find which inner step failed
- Curl the javdb search URL with the same headers to check reachability/blocking
- Verify the search URL and User-Agent still match the current site behavior
- Increase the client timeout if failures correlate with slow responses
- Treat this error in callers as 'source temporarily unavailable' and fall back to other plugins
Defensive patterns
Strategy: try-catch
Validate before calling
// Go: check source reachability before invoking search
resp, err := http.Head("https://javdb.com")
if err != nil || resp.StatusCode >= 400 {
log.Printf("javdb unreachable, skipping")
} Type guard
func isSearchExecFailure(err error) bool {
return err != nil && strings.Contains(err.Error(), "执行搜索失败")
} Try / catch
results, err := p.searchImpl(client, keyword)
if err != nil {
var inner error = errors.Unwrap(err)
log.Printf("javdb search failed (cause=%v): %v", inner, err)
return nil, err
} Prevention
- Always unwrap the %w cause before diagnosing
- Curl the endpoint with the same headers when errors appear
- Keep User-Agent and endpoint URL in sync with site changes
- Treat this as a transient source failure and fall back to other plugins
When it happens
Trigger: executeSearchWithRateLimit returns an error with isRateLimited=false — e.g. request creation failure, client.Do transport error, non-200 status, body read failure, or HTML parse failure.
Common situations: javdb blocks or changes its endpoint; network egress blocked in the container; HTTP client timeout too short; site returns 5xx or a bot-block page; goquery fails on an unexpected response.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- [ ] search request failed on page
- [ ] unexpected status code: on page
- [ ] 搜索请求返回 HTTP
- [ ] 搜索请求返回状态码
- [ ] 请求返回状态码
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/fda17fd55745a73d.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/javdb/javdb.go:117
// SearchWithResult 执行搜索并返回包含IsFinal标记的结果
func (p *JavdbPlugin) SearchWithResult(keyword string, ext map[string]interface{}) (model.PluginSearchResult, error) {
return p.AsyncSearchWithResult(keyword, p.searchImpl, p.MainCacheKey, ext)
}
// searchImpl 搜索实现
func (p *JavdbPlugin) searchImpl(client *http.Client, keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {
if p.debugMode {
log.Printf("[JAVDB] 开始搜索: %s", keyword)
}
if p.debugMode {
log.Printf("[JAVDB] 开始搜索,客户端超时: %v", client.Timeout)
}
// 第一步:执行搜索获取结果列表
searchResults, err, isRateLimited := p.executeSearchWithRateLimit(client, keyword)
if err != nil && !isRateLimited {
return nil, fmt.Errorf("[%s] 执行搜索失败: %w", p.Name(), err)
}
if p.debugMode {
if isRateLimited {
log.Printf("[JAVDB] ⚡ 遇到429限流,但继续处理已获取的 %d 个结果", len(searchResults))
} else {
log.Printf("[JAVDB] 搜索获取到 %d 个结果", len(searchResults))
}
}
// 如果没有搜索结果,直接返回
if len(searchResults) == 0 {
if p.debugMode {
log.Printf("[JAVDB] 无搜索结果,直接返回")
}
return []model.SearchResult{}, nil
}
View on GitHub (pinned to beaa561337)