babalae/better-genshin-impact · error · Exception

目标点未移动到可点击区域:map={mapName}, target=({x:0.##},{y:0.##})

Error message

目标点未移动到可点击区域:map={mapName}, target=({x:0.##},{y:0.##})

What it means

Thrown by ClickMapPoint after MoveMapTo completes but TryGetClickableTargetPosition reports the target coordinate still cannot be mapped to a safe on-screen click position. MoveMapTo panned the map but the final resting position left the target outside the clickable center region or the coordinate-to-pixel conversion failed.

Source

Thrown at BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs:1261

        await MoveMapToCore(x, y, mapName, finalZoomLevel, true, 0);
    }

    /// <summary>
    /// 点击大地图上的指定坐标。
    /// </summary>
    /// <remarks>
    /// 先将目标移动到可点击安全区域,
    /// 再将原神地图坐标转换为游戏截图区域坐标并点击。
    /// </remarks>
    /// <param name="x">目标 x 坐标。</param>
    /// <param name="y">目标 y 坐标。</param>
    /// <param name="mapName">大地图名称。</param>
    public async Task ClickMapPoint(double x, double y, string mapName)
    {
        await MoveMapTo(x, y, mapName);
        if (!TryGetClickableTargetPosition(mapName, x, y, 0, out _, out var clickX, out var clickY))
        {
            throw new Exception($"目标点未移动到可点击区域:map={mapName}, target=({x:0.##},{y:0.##})");
        }

        using var clickCapture = CaptureToRectArea();
        clickCapture.ClickTo(clickX, clickY);
    }

    private async Task MoveMapToTeleportClickArea(double x, double y, string mapName, double requiredVisibleRadius)
    {
        await MoveMapToCore(x, y, mapName, MinTeleportZoomLevel, false, requiredVisibleRadius);
    }

    private async Task MoveMapToCore(
        double x,
        double y,
        string mapName,
        double finalZoomLevel,
        bool allowZoom,
        double requiredVisibleRadius)

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Verify the (x, y) coordinates correspond to a real teleport point within the specified map area.
  2. Ensure MapZoomEnabled and zoom settings allow the target to be brought into the clickable region.
  3. Retry the entire ClickMapPoint call since MoveMapTo is documented as potentially imprecise on first attempt.
  4. Confirm the correct map layer (ground/underground) is active for the target.

Example fix

// before
await MoveMapTo(x, y, mapName);
if (!TryGetClickableTargetPosition(mapName, x, y, 0, out _, out var clickX, out var clickY))
{
    throw new Exception($"目标点未移动到可点击区域:map={mapName}, target=({x:0.##},{y:0.##})");
}
// after: retry MoveMapTo once before giving up
for (int i = 0; i < 2; i++)
{
    await MoveMapTo(x, y, mapName);
    if (TryGetClickableTargetPosition(mapName, x, y, 0, out _, out var clickX, out var clickY))
    {
        using var clickCapture = CaptureToRectArea();
        clickCapture.ClickTo(clickX, clickY);
        return;
    }
}
throw new Exception($"目标点未移动到可点击区域:map={mapName}, target=({x:0.##},{y:0.##})");
Defensive patterns

Strategy: retry

Try / catch

try
{
    await task.ClickMapPoint(x, y, mapName);
}
catch (Exception ex) when (ex.Message.Contains("目标点未移动到可点击区域"))
{
    // MoveMapTo is documented as potentially imprecise; retry once
    await task.ClickMapPoint(x, y, mapName);
}

Prevention

When it happens

Trigger: Called from ClickMapPoint(x, y, mapName). After MoveMapTo finishes, TryGetClickableTargetPosition(mapName, x, y, 0, ...) returns false. This happens when the map's current view doesn't contain the target within the safe margin, or the big-map rect for the area is unavailable/invalid.

Common situations: Target coordinates are at the extreme edge of the map region; the map zoom level is wrong leaving target off-screen; map assets or coordinate conversion data are stale for the area; the map was on a different layer (underground vs surface) than expected.

Related errors


AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13). Data as JSON: /api/errors/d506c67060c5193a. Report an issue: GitHub.