babalae/better-genshin-impact · warning · Exception
暂无前瞻直播资讯!
Error message
暂无前瞻直播资讯!
What it means
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.
Source
Thrown at BetterGenshinImpact/GameTask/UseRedeemCode/GetLiveRedeemCode.cs:171
string code = codeInfo["code"]?.Value<string>();
if (!string.IsNullOrEmpty(code))
result.Add(new RedeemCode(code, items));
}
return result;
}
/// <summary>
/// 获取前瞻直播兑换码信息。返回格式:List[("奖励内容", "兑换码")]
/// </summary>
public async Task<List<RedeemCode>> GetCodeMsgAsync()
{
string actId = await GetActIdAsync("1");
if (string.IsNullOrEmpty(actId))
{
actId = await GetActIdAsync("2");
if (string.IsNullOrEmpty(actId))
throw new Exception("暂无前瞻直播资讯!");
}
var (codeVer, title) = await GetLiveDataAsync(actId);
if (string.IsNullOrEmpty(codeVer))
throw new Exception("前瞻直播数据异常");
var codeList = await GetCodeAsync(codeVer, actId);
return codeList;
}
}
View on GitHub (pinned to a7cb36712d)
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.
Example fix
null
Defensive patterns
Strategy: try-catch
Validate before calling
var actId = await GetActIdAsync("1");
if (string.IsNullOrEmpty(actId)) actId = await GetActIdAsync("2");
if (string.IsNullOrEmpty(actId)) { /* show 'no codes yet' and stop */ } Type guard
null
Try / catch
try { var codes = await svc.GetCodeMsgAsync(); }
catch (Exception ex) { Toast.Warning(ex.Message); /* 'no codes yet' */ } Prevention
- Only invoke during/after a 前瞻直播 window.
- Surface 'no codes available yet' to the user instead of an error.
- Verify upstream API endpoints are reachable.
When it happens
Trigger: 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.
Common situations: 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'.
Related errors
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/0cd9c6a4c8e7ecb7.
Report an issue: GitHub.