fish2018/pansou · error
[susu] 解析按钮详情失败
Error message
[susu] 解析按钮详情失败: %w
What it means
Wrapped decode error in susu's getButtonDetail (plugin/susu/susu.go:471): the button-detail response downloaded but did not unmarshal into buttonDetailResponse — unexpected payload (challenge page or schema change).
Solutions
- Log the raw body prefix to distinguish HTML-block from schema drift
- Update buttonDetailResponse fields when the API changes
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at plugin/susu/susu.go:471 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/f9dd6ba2945baa26.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/susu/susu.go:471
resp, err := p.doRequestWithRetry(client, req, MaxRetries)
if err != nil {
return model.Link{}, fmt.Errorf("[susu] 获取按钮详情失败: %w", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return model.Link{}, fmt.Errorf("[susu] 按钮详情请求返回状态码: %d", resp.StatusCode)
}
// 读取响应体
respBody, err := io.ReadAll(io.LimitReader(resp.Body, 2<<20))
if err != nil {
return model.Link{}, fmt.Errorf("[susu] 读取按钮详情失败: %w", err)
}
// 解析响应
var buttonDetail buttonDetailResponse
if err := json.Unmarshal(respBody, &buttonDetail); err != nil {
return model.Link{}, fmt.Errorf("[susu] 解析按钮详情失败: %w", err)
}
// 如果URL为空
if buttonDetail.Button.URL == "" {
return model.Link{}, fmt.Errorf("[susu] 按钮URL为空")
}
// 解析JWT token获取真实链接
realURL, err := p.decodeJWTURL(buttonDetail.Button.URL)
if err != nil {
return model.Link{}, fmt.Errorf("[susu] 解析JWT失败: %w", err)
}
realURL = strings.TrimSpace(realURL)
parsedURL, err := url.Parse(realURL)
if err != nil || (parsedURL.Scheme != "http" && parsedURL.Scheme != "https") || parsedURL.Host == "" {
return model.Link{}, fmt.Errorf("[susu] 按钮返回无效链接")
}
View on GitHub (pinned to beaa561337)