fish2018/pansou · error
[ ] 搜索关键词不能为空
Error message
[%s] 搜索关键词不能为空
What it means
Sentinel validation error in YulinshufaPlugin.searchImpl (plugin/yulinshufa/yulinshufa.go:137): the keyword is empty after trimming (and title_en fallback produced nothing usable), so the search is skipped before any request.
Solutions
- Reject empty keywords at the entry point before invoking the plugin
- Skip the plugin for blank inputs instead of erroring
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at plugin/yulinshufa/yulinshufa.go:137 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/9a372dd86ed3f488.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/yulinshufa/yulinshufa.go:137
return nil, err
}
return result.Results, nil
}
// SearchWithResult 返回带IsFinal的结果
func (p *YulinshufaPlugin) SearchWithResult(keyword string, ext map[string]interface{}) (model.PluginSearchResult, error) {
return p.AsyncSearchWithResult(keyword, p.searchImpl, p.MainCacheKey, ext)
}
func (p *YulinshufaPlugin) searchImpl(client *http.Client, keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {
searchKeyword := strings.TrimSpace(keyword)
if ext != nil {
if titleEn, ok := ext["title_en"].(string); ok && strings.TrimSpace(titleEn) != "" {
searchKeyword = strings.TrimSpace(titleEn)
}
}
if searchKeyword == "" {
return nil, fmt.Errorf("[%s] 搜索关键词不能为空", p.Name())
}
p.debugf("开始搜索, keyword=%s", searchKeyword)
items, err := p.fetchSearchItems(client, searchKeyword)
if err != nil {
p.debugf("搜索请求失败: %v", err)
return nil, err
}
if len(items) == 0 {
p.debugf("搜索结果为空")
return []model.SearchResult{}, nil
}
p.debugf("搜索解析到 %d 条候选结果", len(items))
results := p.fetchDetailResults(items)
validResults := make([]model.SearchResult, 0, len(results))
for _, res := range results {
if len(res.Links) == 0 {View on GitHub (pinned to beaa561337)