fish2018/pansou · error

loginResp.Message (dynamic remote login failure message)

Error message

loginResp.Message (dynamic remote login failure message)

What it means

When the remote pan-site login API returns success=false, the plugin wraps loginResp.Message (the remote's own failure text, trimmed) in a plain error. The message is dynamic and comes from the upstream server, so text varies (e.g. wrong password, captcha needed, account locked).

Solutions

  1. Verify the configured pan-site username/password are correct
  2. Log the trimmed loginResp.Message to see the exact upstream reason and act on it (captcha, lockout, etc.)
  3. Re-test with a manual browser login to confirm the account is not locked or captcha-gated
  4. Check whether the site changed its login API/response format and update LoginResponse parsing

Example fix

// before
if !loginResp.Success {
    return "", nil, errors.New(strings.TrimSpace(loginResp.Message))
}
// after
if !loginResp.Success {
    return "", nil, fmt.Errorf("pan login failed: %s", strings.TrimSpace(loginResp.Message))
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-validate credentials non-empty before calling login
if user == "" || pass == "" { return errors.New("missing pan credentials") }

Try / catch

cookie, links, err := login()
if err != nil {
    log.Printf("pan login failed: %v", err) // message is remote's own text
    return err
}

Prevention

When it happens

Trigger: POSTing credentials to the pan-site login endpoint and receiving a JSON body with success=false; also triggered indirectly if json unmarshal of the response fails (separate wrapped error).

Common situations: Wrong username/password configured for the pan site; account requires captcha or SMS verification; account temporarily locked; site changed its response schema so Success is false by default.

Related errors


AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07). Data as JSON: /api/errors/a228c23953160db3. Report an issue: GitHub.

Appendix: source

Thrown at plugin/panlian/panlian.go:1130

		return "", nil, err
	}
	defer resp.Body.Close()

	respBody, err := io.ReadAll(resp.Body)
	cancel()
	if err != nil {
		return "", nil, err
	}
	if resp.StatusCode != http.StatusOK {
		return "", nil, fmt.Errorf("登录请求失败: HTTP %d", resp.StatusCode)
	}

	var loginResp LoginResponse
	if err := json.Unmarshal(respBody, &loginResp); err != nil {
		return "", nil, fmt.Errorf("解析登录响应失败: %w", err)
	}
	if !loginResp.Success {
		return "", nil, errors.New(strings.TrimSpace(loginResp.Message))
	}

	cookieString := cookiesToString(jar.Cookies(baseURL))
	if cookieString == "" {
		return "", nil, fmt.Errorf("登录成功但未获取到有效 Cookie")
	}

	return cookieString, &loginResp, nil
}

func (p *PanlianPlugin) reloginUser(user *User) error {
	password, err := p.decryptPassword(user.EncryptedPassword)
	if err != nil {
		return err
	}
	cookie, _, err := p.doLogin(user.Username, password, true)
	if err != nil {
		user.Status = "expired"

View on GitHub (pinned to beaa561337)