{"record":{"id":"b35654c05d1ca797","repo":"fish2018/pansou","slug":"w-b35654","errorCode":null,"errorMessage":"解密密码失败: %w","messagePattern":"解密密码失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/gying/gying.go","lineNumber":2276,"sourceCode":"\t}\n\treturn b\n}\n\n// ============ 重新登录逻辑 ============\n\n// reloginUser 重新登录指定用户\nfunc (p *GyingPlugin) reloginUser(user *User) error {\n\tif DebugLog {\n\t\tfmt.Printf(\"[Gying] 🔄 开始重新登录用户: %s\\n\", user.Username)\n\t}\n\n\t// 解密密码\n\tpassword, err := p.decryptPassword(user.EncryptedPassword)\n\tif err != nil {\n\t\tif DebugLog {\n\t\t\tfmt.Printf(\"[Gying] ❌ 解密密码失败: %v\\n\", err)\n\t\t}\n\t\treturn fmt.Errorf(\"解密密码失败: %w\", err)\n\t}\n\n\t// 执行登录\n\tscraper, cookie, err := p.doLogin(user.Username, password)\n\tif err != nil {\n\t\tif DebugLog {\n\t\t\tfmt.Printf(\"[Gying] ❌ 重新登录失败: %v\\n\", err)\n\t\t}\n\t\treturn fmt.Errorf(\"重新登录失败: %w\", err)\n\t}\n\n\t// 更新scraper实例\n\tp.scrapers.Store(user.Hash, scraper)\n\n\t// 更新用户信息\n\tuser.Cookie = cookie\n\tuser.LoginAt = time.Now()\n\tuser.ExpireAt = time.Now().AddDate(0, 4, 0)","sourceCodeStart":2258,"sourceCodeEnd":2294,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/gying/gying.go#L2258-L2294","documentation":"Wraps the failure of p.decryptPassword when trying to decrypt a user's stored EncryptedPassword during the login flow. The library keeps user passwords encrypted at rest and decrypts them just before calling doLogin; if decryption fails (wrong key, corrupted ciphertext, unsupported format), the login aborts and this wrapped error is returned so the underlying cause is preserved via %w.","triggerScenarios":"Calling the plugin's login/relogin path (e.g. reloginUser) for a user whose EncryptedPassword cannot be decrypted: ciphertext produced by a different encryption key or plugin version, empty/corrupted stored password, or an unsupported encryption scheme in decryptPassword.","commonSituations":"Users migrated from another instance with a different encryption key; encrypted password blob truncated in the config/store; plugin upgraded and the decryption scheme changed; EncryptedPassword field pasted manually instead of the encrypted value.","solutions":["Re-enter/re-save the account's plain password so EncryptedPassword is re-encrypted with the current key.","Verify the encryption key/configuration is the same one used when the password was stored.","Enable DebugLog to see the raw decrypt error printed by decryptPassword and fix the specific cause.","Update the plugin if the EncryptedPassword was produced by an older/other version with a different scheme."],"exampleFix":"// before\nuser.EncryptedPassword = oldBase64BlobFromOtherInstance\n// after\nuser.EncryptedPassword = encryptWithCurrentKey(plainPassword) // re-save credentials","handlingStrategy":"try-catch","validationCode":"if user == nil || user.EncryptedPassword == \"\" {\n    return errors.New(\"user has no encrypted password stored\")\n}","typeGuard":null,"tryCatchPattern":"password, err := p.decryptPassword(user.EncryptedPassword)\nif err != nil {\n    // errors.Is/As on the wrapped cause; recover by re-saving credentials\n    return fmt.Errorf(\"re-save credentials for user %s: %w\", user.Username, err)\n}","preventionTips":["Always save credentials through the plugin's own encrypt path, never paste encrypted blobs manually.","Keep the encryption key/config stable across deployments or provide a migration step.","Back up the key used to encrypt stored passwords."],"tags":["authentication","decryption","credentials"],"backgroundTag":"password-decryption-failed","analyzedSha":"beaa56133755a548ebc51b090b3816e2ae044aa6","analyzedAt":"2026-09-07T00:31:18.025Z","contentChangedAt":"2026-09-07T00:31:18.025Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}