{"record":{"id":"0cd9c6a4c8e7ecb7","repo":"babalae/better-genshin-impact","slug":"error-0cd9c6","errorCode":null,"errorMessage":"暂无前瞻直播资讯！","messagePattern":"暂无前瞻直播资讯！","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"BetterGenshinImpact/GameTask/UseRedeemCode/GetLiveRedeemCode.cs","lineNumber":171,"sourceCode":"            string code = codeInfo[\"code\"]?.Value<string>();\n            if (!string.IsNullOrEmpty(code))\n                result.Add(new RedeemCode(code, items));\n        }\n\n        return result;\n    }\n\n    /// <summary>\n    /// 获取前瞻直播兑换码信息。返回格式：List[(\"奖励内容\", \"兑换码\")]\n    /// </summary>\n    public async Task<List<RedeemCode>> GetCodeMsgAsync()\n    {\n        string actId = await GetActIdAsync(\"1\");\n        if (string.IsNullOrEmpty(actId))\n        {\n            actId = await GetActIdAsync(\"2\");\n            if (string.IsNullOrEmpty(actId))\n                throw new Exception(\"暂无前瞻直播资讯！\");\n        }\n\n        var (codeVer, title) = await GetLiveDataAsync(actId);\n        if (string.IsNullOrEmpty(codeVer))\n            throw new Exception(\"前瞻直播数据异常\");\n        var codeList = await GetCodeAsync(codeVer, actId);\n        return codeList;\n    }\n}\n","sourceCodeStart":153,"sourceCodeEnd":181,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/UseRedeemCode/GetLiveRedeemCode.cs#L153-L181","documentation":"A generic Exception from GetCodeMsgAsync thrown when both GetActIdAsync('1') and GetActIdAsync('2') return an empty actId. It means no livestream (前瞻直播) activity is currently registered in the upstream data source, so redeem codes cannot be fetched. This is a data-availability condition, not a parse error.","triggerScenarios":"Calling GetCodeMsgAsync outside the livestream reveal window, or when the upstream miHoYo/HoYoLAB activity index has no current act entry for either id slot. Both actId lookups returning empty trips the throw.","commonSituations":"Running the redeem-code feature when no special-program livestream is active; upstream API change that moved the actId; regional availability (the codes may exist only in CN); rate limiting or transient empty response interpreted as 'no data'.","solutions":["Retry later when a 前瞻直播 (special program) is actually airing or has aired recently.","Verify network connectivity and that the upstream API endpoints are reachable.","Catch the exception at the UI boundary and show a user-facing 'no codes available yet' message rather than an error.","Confirm the API base URLs and actId slots in GetActIdAsync still match the upstream contract."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"var actId = await GetActIdAsync(\"1\");\nif (string.IsNullOrEmpty(actId)) actId = await GetActIdAsync(\"2\");\nif (string.IsNullOrEmpty(actId)) { /* show 'no codes yet' and stop */ }","typeGuard":"null","tryCatchPattern":"try { var codes = await svc.GetCodeMsgAsync(); }\ncatch (Exception ex) { Toast.Warning(ex.Message); /* 'no codes yet' */ }","preventionTips":["Only invoke during/after a 前瞻直播 window.","Surface 'no codes available yet' to the user instead of an error.","Verify upstream API endpoints are reachable."],"tags":["redeem-code","network","data-availability","external-api"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}