babalae/better-genshin-impact · error · InvalidOperationException
没找到最近的七天神像
Error message
没找到最近的七天神像
What it means
InvalidOperationException from GetNearestGoddess when the GoddessPositions dictionary (built from tp.json entries of Type=="Goddess") contains no entries, so nearestGiTpPosition stays null. This is a data/config error: the game's Statue of the Seven (七天神像) list is empty, so no nearest statue can be returned for teleport fallback.
Source
Thrown at BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs:354
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
private GiTpPosition GetNearestGoddess(double x, double y)
{
GiTpPosition? nearestGiTpPosition = null;
double minDistance = double.MaxValue;
foreach (var (_, goddessPosition) in MapLazyAssets.Get().GoddessPositions)
{
var distance = Math.Sqrt(Math.Pow(goddessPosition.X - x, 2) + Math.Pow(goddessPosition.Y - y, 2));
if (distance < minDistance)
{
minDistance = distance;
nearestGiTpPosition = goddessPosition;
}
}
// 获取最近的神像位置
return nearestGiTpPosition ?? throw new InvalidOperationException("没找到最近的七天神像");
}
/// <summary>
///释放所有按键,并打开大地图界面
/// </summary>
/// <param name="retryCount">重试次数</param>
public async Task OpenBigMapUi(int retryCount = 3, string? mapName = null)
{
for (var i = 0; i < retryCount; i++)
{
try
{
// 打开地图前释放所有按键
Simulation.ReleaseAllKey();
await Delay(GetTeleportOperationDelay(20), ct);
await CheckInBigMapUi(mapName);
return;
}View on GitHub (pinned to a7cb36712d)
Solutions
- Restore the original GameTask/AutoTrackPath/Assets/tp.json from a known-good release.
- Verify tp.json parses and contains entries with "type":"Goddess".
- Clear the MapLazyAssets cache (restart the app) so the Lazy re-initializes from the corrected file.
- Add a guard at MapLazyAssets construction to fail loudly with a clear message if GoddessPositions is empty.
Example fix
// before
return nearestGiTpPosition ?? throw new InvalidOperationException("没找到最近的七天神像");
// after: fail at load time with the real cause
if (_goddessPositions.Count == 0)
throw new InvalidOperationException("tp.json 未包含任何 Goddess(七天神像)条目,请检查资源文件完整性。");
...
return nearestGiTpPosition ?? throw new InvalidOperationException("没找到最近的七天神像"); Defensive patterns
Strategy: validation
Validate before calling
if (MapLazyAssets.Get().GoddessPositions.Count == 0)
return Result.Fail("tp.json 缺少七天神像数据,传送功能不可用"); Prevention
- Validate tp.json integrity and the Goddess count at startup.
- Ship tp.json as a versioned asset and fail loudly if missing/empty.
- Restart the app after replacing a corrupt tp.json so the Lazy cache rebuilds.
When it happens
Trigger: MapLazyAssets failed to populate _goddessPositions because tp.json is missing/corrupt/filtered so no Type=="Goddess" entries exist; the Lazy<MapLazyAssets> cache was built from a partially-loaded tp.json; tp.json deserialization dropped the Goddess entries due to a schema change.
Common situations: Corrupted or outdated GameTask/AutoTrackPath/Assets/tp.json; custom build that excluded the asset; new game version added new tp.json schema and old file has no Goddess entries; file read partially failed at startup.
Related errors
- Unable to GetLabelByIndex: index {i} out of range {labels.Co
- 未找到{taskName}的素材文件夹
- 未找到{taskName}中的{assetName}文件
- 未找到首领路线文件:{route}
- 路径文件解析失败:{fileName}
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/40e4debb2e6b4adc.
Report an issue: GitHub.