fish2018/pansou · error
提取登录信息失败
Error message
提取登录信息失败: %w
What it means
In checkQRLoginStatus (plugin/qqpd/qqpd.go:1798), when the QR-login response contains '登录成功', the plugin calls extractLoginInfo to pull ptsigx and uin from the ptuiCB callback. If that parsing fails, the error is wrapped as '提取登录信息失败: %w'. It means QQ's login response was reported successful but its body did not match the expected ptuiCB format.
Solutions
- Log the full response body (the plugin already prints it) and check whether the ptuiCB format changed
- Update the regexes in extractLoginInfo to match the current QQ response format
- Re-generate the QR code and retry the login — a stale/expired QR can yield malformed responses
- Check for a pending confirmation state (user must confirm on the phone) before parsing
Example fix
// before
return nil, fmt.Errorf("提取登录信息失败: %w", err)
// after
return nil, fmt.Errorf("提取登录信息失败 (响应: %.200s): %w", bodyStr, err) Defensive patterns
Strategy: try-catch
Try / catch
user, err := p.checkQRLoginStatus(qrsig)
if err != nil {
if strings.Contains(err.Error(), "提取登录信息失败") {
// log the raw response and fall back to re-issuing the QR code
}
return err
} Prevention
- Log raw ptqrlogin responses to detect QQ format changes early
- Regenerate QR codes promptly instead of polling expired sessions
- Require phone-side confirmation to complete before parsing the response
- Pin/monitor the login flow so format changes are caught in staging
When it happens
Trigger: handleCheckLogin polls checkQRLoginStatus; the response body contains '登录成功' but extractLoginInfo fails to find ptuiCB(...), the URL, ptsigx, or uin in it.
Common situations: QQ changed the ptqrlogin response format, a login confirmation step is pending so the URL lacks the expected query parameters, or an HTML error/captcha page is returned despite the success marker.
Related errors
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/0f803c9dde93cf23.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/qqpd/qqpd.go:1798
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
bodyStr := string(body)
// 检查登录状态
if strings.Contains(bodyStr, "二维码已失效") {
return &LoginResult{Status: "expired"}, nil
}
if strings.Contains(bodyStr, "登录成功") {
// 提取ptsigx和uin
ptsigx, uin, err := p.extractLoginInfo(bodyStr)
if err != nil {
fmt.Printf("[QQPD] 提取登录信息失败: %v, 响应: %s\n", err, bodyStr)
return nil, fmt.Errorf("提取登录信息失败: %w", err)
}
// 获取完整Cookie(传递ptqrlogin返回的所有Set-Cookie)
allSetCookies := resp.Header.Values("Set-Cookie")
setCookieStr := strings.Join(allSetCookies, "; ")
cookie, err := p.fetchFullCookie(uin, ptsigx, setCookieStr)
if err != nil {
fmt.Printf("[QQPD] 获取Cookie失败: %v\n", err)
return nil, fmt.Errorf("获取Cookie失败: %w", err)
}
// 生成脱敏QQ号
qqMasked := p.maskQQ(uin)
if DebugLog {
fmt.Printf("[QQPD] 登录成功!QQ: %s, Cookie长度: %d, 包含keys: ", qqMasked, len(cookie))
cookies := parseCookieString(cookie)View on GitHub (pinned to beaa561337)