babalae/better-genshin-impact · error · Exception
暂时不支持展示路径的地图类型:{mapName}
Error message
暂时不支持展示路径的地图类型:{mapName} What it means
Thrown by MapViewerViewModel.Init when mapName matches none of the known MapTypes enum values (Teyvat, TheChasm, Enkanomiya, SeaOfBygoneEras, AncientSacredMountain, TempleOfSpace, MoonCanon). A pathing file or caller supplied a map name that has no corresponding image-asset branch in Init.
Source
Thrown at BetterGenshinImpact/ViewModel/Windows/MapViewerViewModel.cs:128
else if (mapName == MapTypes.SeaOfBygoneEras.ToString())
{
_mapImage = new Mat(Global.Absolute(@"Assets/Map/SeaOfBygoneEras/SeaOfBygoneEras_0_1024.png"));
}
else if (mapName == MapTypes.AncientSacredMountain.ToString())
{
_mapImage = new Mat(Global.Absolute(@"Assets/Map/AncientSacredMountain/AncientSacredMountain_0_1024.png"));
}
else if (mapName == MapTypes.TempleOfSpace.ToString())
{
_mapImage = new Mat(Global.Absolute(@"Assets/Map/TempleOfSpace/TempleOfSpace_0_1024.png"));
}
else if (mapName == MapTypes.MoonCanon.ToString())
{
_mapImage = new Mat(Global.Absolute(@"Assets/Map/MoonCanon/MoonCanon_0_1024.png"));
}
else
{
throw new Exception("暂时不支持展示路径的地图类型:" + mapName);
}
}
public Mat ClipMat(Point2f pos)
{
try
{
var len = 256;
pos = new Point2f(pos.X - _currentPathingRect.X, pos.Y - _currentPathingRect.Y);
Rect rect = new((int)pos.X - len, (int)pos.Y - len, len * 2, len * 2);
// 处理越界
if (rect.X < 0)
{
rect.X = 0;
}
if (rect.Y < 0)
{
rect.Y = 0;View on GitHub (pinned to a7cb36712d)
Solutions
- Add the missing map case to Init pointing at the correct Assets/Map/<Name>/<Name>_0_*.png asset.
- Validate mapName against the known MapTypes set before calling Init and skip unsupported maps gracefully.
- Ensure pathing files only reference MapTypes enum members that have corresponding assets.
Example fix
// before
else
{
throw new Exception("暂时不支持展示路径的地图类型:" + mapName);
}
// after (add the missing case + typed exception)
else if (mapName == MapTypes.NewRegion.ToString())
{
_mapImage = new Mat(Global.Absolute(@"Assets/Map/NewRegion/NewRegion_0_1024.png"));
}
else
{
throw new ArgumentException($"暂时不支持展示路径的地图类型:{mapName}", nameof(mapName));
} Defensive patterns
Strategy: validation
Validate before calling
var supported = new[] { MapTypes.Teyvat, MapTypes.TheChasm, MapTypes.Enkanomiya,
MapTypes.SeaOfBygoneEras, MapTypes.AncientSacredMountain, MapTypes.TempleOfSpace, MapTypes.MoonCanon };
if (!supported.Any(m => m.ToString() == mapName))
{
// skip this map; do not call Init
} Type guard
static bool IsSupportedMap(string mapName) =>
Enum.GetNames<MapTypes>().Contains(mapName); Prevention
- Keep the Init branch list in sync with the MapTypes enum.
- Skip unsupported maps gracefully instead of throwing during viewer init.
- Validate pathing files reference only enum members that have bundled assets.
When it happens
Trigger: A pathing JSON references a map type string with no asset case; a new MapTypes enum member was added without updating Init; a legacy or unexpected map name is passed in.
Common situations: A new game region ships; pathing data uses a typo'd or localized map name; case mismatch between the stored string and the enum; enum extended but asset PNG not bundled.
Related errors
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/0fa3dad4ab118d0d.
Report an issue: GitHub.