{"record":{"id":"2f41f3c5f651de04","repo":"RayWangQvQ/BiliBiliToolPro","slug":"re-tojsonstr-vipbigpointdomainservice","errorCode":null,"errorMessage":"re.ToJsonStr()","messagePattern":"re\\.ToJsonStr\\(\\)","errorType":"exception","errorClass":"BiliBusinessException","httpStatus":null,"severity":"error","filePath":"src/Ray.BiliBiliTool.DomainService/VipBigPointDomainService.cs","lineNumber":117,"sourceCode":"    {\n        var signInfo = await apiApi.GetThreeDaySignAsync(\n            new ThreeDaySignRequest { csrf = ck.BiliJct },\n            ck.ToString()\n        );\n        if (signInfo.Data.three_day_sign.signed)\n        {\n            logger.LogInformation(\"已完成，跳过\");\n            logger.LogInformation(signInfo.Data.ToString());\n            return;\n        }\n\n        BiliApiResponse<Sign2Response> re = await apiApi.Sign2Async(\n            new Sign2RequestPath(ck.BiliJct),\n            new Sign2Request(),\n            ck.ToString()\n        );\n        if (re.Code != 0)\n            throw new BiliBusinessException(re.ToJsonStr());\n\n        logger.LogInformation(\"签到成功\");\n        logger.LogInformation(re.Data.ToString());\n\n        signInfo = await apiApi.GetThreeDaySignAsync(\n            new ThreeDaySignRequest { csrf = ck.BiliJct },\n            ck.ToString()\n        );\n        signInfo.Data.LogPointInfo(logger);\n    }\n\n    /// <summary>\n    /// 领取任务\n    /// </summary>\n    /// <param name=\"combine\"></param>\n    /// <param name=\"ck\"></param>\n    public async Task ReceiveDailyMissionsAsync(VipBigPointCombine combine, BiliCookie ck)\n    {","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/RayWangQvQ/BiliBiliToolPro/blob/c599b2c0da964e16ea8c454397aa07bb16212628/src/Ray.BiliBiliTool.DomainService/VipBigPointDomainService.cs#L99-L135","documentation":"SignAsync performs the daily VIP check-in via Sign2Async. On a non-zero API code it throws BiliBusinessException containing the full response JSON (re.ToJsonStr()). The check-in endpoint requires valid login cookies; failures are almost always authentication or risk-control responses from Bilibili.","triggerScenarios":"Expired SESSDATA/bili_jct in the cookie, Bilibili returning -101 (not logged in) or -412 (risk control) for the sign endpoint, or calling sign twice in a day if the API rejects duplicate signs with an error code.","commonSituations":"Daily cron run with a stale cookie; account flagged by anti-bot after frequent requests; multiple instances of the tool signing with the same account causing conflicts.","solutions":["Refresh the BiliBiliCookies config value with a newly exported cookie.","Read the JSON in the exception message for the upstream code/message (-101 => re-login, -412 => reduce frequency/change IP).","Ensure only one instance of the scheduled tool runs per account.","Catch BiliBusinessException around sign tasks so other daily tasks still execute."],"exampleFix":"// before\nawait vipBigPointService.SignAsync(dailyTaskInfo, ck);\n// after\ntry { await vipBigPointService.SignAsync(dailyTaskInfo, ck); }\ncatch (BiliBusinessException ex)\n{\n    logger.LogWarning(\"大会员签到失败: {Msg}\", ex.Message);\n}","handlingStrategy":"try-catch","validationCode":"if (string.IsNullOrWhiteSpace(ck.Sessdata) || string.IsNullOrWhiteSpace(ck.BiliJct))\n    logger.LogWarning(\"Cookie不完整，签到大概率失败\");","typeGuard":null,"tryCatchPattern":"try { await svc.SignAsync(info, ck); }\ncatch (BiliBusinessException ex)\n{\n    logger.LogWarning(\"签到失败: {Msg}\", ex.Message);\n}","preventionTips":["Refresh SESSDATA/bili_jct before scheduled runs","Run only one instance per account","Inspect exception JSON for -101/-412 codes","Continue other tasks when sign fails"],"tags":["bilibili-api","sign-in","cookie-expired","business-exception"],"backgroundTag":"api-error-response","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"}