{"record":{"id":"77572469331b251a","repo":"RayWangQvQ/BiliBiliToolPro","slug":"logindomainservice","errorCode":null,"errorMessage":"登录超时","messagePattern":"登录超时","errorType":"exception","errorClass":"BiliIntegrationException","httpStatus":null,"severity":"error","filePath":"src/Ray.BiliBiliTool.DomainService/LoginDomainService.cs","lineNumber":108,"sourceCode":"                logger.LogInformation(\"扫描成功！\");\n                IEnumerable<string> cookies = check\n                    .Headers.SingleOrDefault(header => header.Key == \"Set-Cookie\")\n                    .Value;\n\n                var cookieStr = CookieInfo.ConvertSetCkHeadersToCkStr(cookies);\n\n                cookieInfo = CookieStrFactory<BiliCookie>.CreateNew(cookieStr);\n                cookieInfo.Check();\n\n                break;\n            }\n\n            logger.LogInformation(\"{msg}\", content.Data.Message + Environment.NewLine);\n        }\n\n        if (cookieInfo == null)\n        {\n            throw new BiliIntegrationException(\"登录超时\");\n        }\n\n        return cookieInfo;\n    }\n\n    public async Task<BiliCookie> SetCookieAsync(\n        BiliCookie biliCookie,\n        CancellationToken cancellationToken\n    )\n    {\n        try\n        {\n            var homePage = await homeApi.GetHomePageAsync(biliCookie.ToString());\n            if (homePage.IsSuccessStatusCode)\n            {\n                logger.LogInformation(\"访问主站成功\");\n                IEnumerable<string> setCookieHeaders = homePage\n                    .Headers.SingleOrDefault(header => header.Key == \"Set-Cookie\")","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/RayWangQvQ/BiliBiliToolPro/blob/c599b2c0da964e16ea8c454397aa07bb16212628/src/Ray.BiliBiliTool.DomainService/LoginDomainService.cs#L90-L126","documentation":"Thrown by LoginByQrCodeAsync when the QR code login polling loop finishes without ever receiving a confirmed cookie. The user either never scanned the QR code, didn't confirm on the phone, or the code expired before confirmation, so cookieInfo remains null and a BiliIntegrationException '登录超时' is raised.","triggerScenarios":"The polling loop over passportApi.CheckQrCode times out (typically ~120-190s) because the QR code was never scanned, scan wasn't confirmed, or the code expired (QR codes expire quickly).","commonSituations":"Running headless/scheduled and not scanning in time; console not rendering the QR code legibly; Bilibili QR expired because the login attempt started long before scanning.","solutions":["Rerun the login command and scan + confirm the QR code promptly on the Bilibili app.","If the console QR is unreadable, use the web QR code flow (GenerateQrCodeWebAsync) or copy the QR URL manually.","Increase the polling timeout if you need more time to scan."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    var cookie = await loginDomainService.LoginByQrCodeAsync();\n}\ncatch (BiliIntegrationException ex) when (ex.Message == \"登录超时\")\n{\n    logger.LogInformation(\"未在时限内扫码确认，请重新运行登录命令\");\n}","preventionTips":["Run the login command interactively and scan the QR code immediately.","Use the web QR flow if the console-rendered QR is hard to scan.","Have the Bilibili mobile app logged in and ready before starting."],"tags":["bilibili-login","qrcode","timeout","user-interaction"],"backgroundTag":"login-qr-code-timeout","analyzedSha":"c599b2c0da964e16ea8c454397aa07bb16212628","analyzedAt":"2026-09-12T09:48:04.090Z","contentChangedAt":"2026-09-12T09:48:04.090Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}