fish2018/pansou · error
登录失败: code= , 响应=
Error message
登录失败: code=%d, 响应=%s
What it means
gying treats the login POST's JSON 'code' field as the business-level success signal, requiring exactly 200. Any other value (wrong password, account locked, captcha required, server-side rejection) yields '登录失败: code=%d, 响应=%s', including the raw response body so the caller can see the server's message.
Solutions
- Read the 响应 payload in the error to find the server's message and the actual code value.
- Re-check credentials; re-enter or reset the password if the code indicates auth rejection.
- Check whether the account requires captcha/2FA/verification — the plugin cannot complete such logins automatically.
- Try logging in via a browser to confirm account status (locked, expired, region-blocked).
- If the site changed its API contract, update the plugin's expected success code.
Defensive patterns
Strategy: validation
Validate before calling
// check credentials and account state before invoking login
if user == "" || pass == "" {
return errors.New("credentials required before login")
}
// treat any returned non-200 code as an auth problem, not a bug Prevention
- Store credentials securely and verify them after password changes.
- Handle captcha/2FA accounts outside the automated flow.
- Don't retry blindly on auth-rejection codes — retrying wrong credentials risks lockout.
- Read the embedded response body to identify risk-control or captcha codes.
When it happens
Trigger: Login step 2 parsed successfully but loginResp["code"] != 200 — e.g. 401/400-style codes for bad credentials, risk-control codes, or any non-200 business code returned by the site's login API.
Common situations: Wrong username/password after a password change; account banned or requiring captcha/2FA; site changed its success code convention; submitting credentials to a stale endpoint that answers with an error code.
Related errors
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/dbd05e1d2d029915.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/gying/gying.go:2213
parsed, err := strconv.Atoi(codeStr)
if err != nil {
if DebugLog {
fmt.Printf("[Gying] 无法解析code字段: %T, 值: %v, 错误: %v\n", codeInterface, codeInterface, err)
}
return nil, "", fmt.Errorf("无法解析code字段,类型: %T, 值: %v", codeInterface, codeInterface)
}
codeValue = parsed
}
if DebugLog {
fmt.Printf("[Gying] 解析后的code值: %d\n", codeValue)
}
if codeValue != 200 {
if DebugLog {
fmt.Printf("[Gying] 登录失败: code=%d (期望200)\n", codeValue)
}
return nil, "", fmt.Errorf("登录失败: code=%d, 响应=%s", codeValue, string(body))
}
// ========== 步骤3: GET详情页 (触发防爬cookies如vrg_sc、vrg_go等) ==========
if DebugLog {
fmt.Printf("[Gying] 步骤3: GET详情页收集完整Cookie\n")
}
_, warmupStatus, warmupHeaders, err := p.requestWithChallengeRetry(scraper, http.MethodGet, p.getWarmupDetailURL(), "", "")
if err == nil {
if DebugLog {
fmt.Printf("[Gying] 详情页状态码: %d\n", warmupStatus)
}
// 从详情页响应中收集cookies
collectSetCookies(warmupHeaders, cookieMap)
logSetCookiesForDebug(warmupHeaders, "[Gying] 详情页Cookie: %s=%s\n", 30)
}
// 构建cookie字符串View on GitHub (pinned to beaa561337)