{"record":{"id":"5960decfcf89efe2","repo":"babalae/better-genshin-impact","slug":"error-5960de","errorCode":null,"errorMessage":"传送失败","messagePattern":"传送失败","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs","lineNumber":1230,"sourceCode":"            catch (TpPointNotActivate e)\n            {\n                // 未激活点位的详情面板会遮挡后续地图操作，重试前先关闭。\n                // 最后一次失败也需要执行清理，避免影响脚本组中的下一个任务。\n                Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_ESCAPE);\n                await Delay(300, ct);\n                // throw; // 不抛出异常，继续重试\n                Logger.LogWarning(e.Message + \"  重试\");\n            }\n            catch (Exception e) when (IsTaskStopException(e))\n            {\n                throw;\n            }\n            catch (Exception)\n            {\n            }\n        }\n\n        throw new InvalidOperationException(\"传送失败\");\n    }\n\n    /// <summary>\n    /// 移动地图到指定传送点位置\n    /// 可能会移动不对，所以可以重试此方法\n    /// </summary>\n    /// <param name=\"x\">目标x坐标</param>\n    /// <param name=\"y\">目标y坐标</param>\n    /// <param name=\"mapName\">地图名称</param>\n    /// <param name=\"finalZoomLevel\">到达目标点的最小缩放等级，只在 MapZoomEnabled 为 True 生效</param>\n    public async Task MoveMapTo(double x, double y, string mapName, double finalZoomLevel = 2)\n    {\n        await MoveMapToCore(x, y, mapName, finalZoomLevel, true, 0);\n    }\n\n    /// <summary>\n    /// 点击大地图上的指定坐标。\n    /// </summary>","sourceCodeStart":1212,"sourceCodeEnd":1248,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs#L1212-L1248","documentation":"Thrown by TpWithRetries after the teleport retry loop (3 attempts) in TpTask.cs exhausts all iterations. Each attempt calls TpOnce, and the loop swallows both TpPointNotActivate and generic non-task-stop exceptions, logging a warning. Only when every attempt fails does it throw InvalidOperationException(\"传送失败\"). This means the single-teleport pipeline (open map → pan → click → confirm) never succeeded within the allowed retries.","triggerScenarios":"Called from TpWithRetries(tpX, tpY, mapName, force) when TpOnce throws 3 consecutive times. Each failure can stem from TpPointNotActivate (teleport point not activated, ESC pressed to dismiss), an unhandled exception during map interaction, or any recognition failure that propagates as a non-task-stop exception.","commonSituations":"Game window lost focus or is occluded during teleport; the target teleport point is locked/unactivated; the map UI didn't open in time; network/lag caused the teleport confirmation panel to not appear; wrong mapName or coordinates pointing to an unreachable area.","solutions":["Ensure the game window is focused and in the foreground before the teleport task starts.","Verify the target teleport point is activated in-game (unlock it manually first).","Increase the retry count or per-attempt timeout in the teleport configuration if lag is suspected.","Check that the map name and coordinates are valid and reachable for the current game state.","Inspect the logged warnings from each retry iteration for the root cause (e.g. recognition failures, panel not found)."],"exampleFix":"// before: catch swallows all non-task-stop exceptions\n// catch (Exception) { }\n// after: log the swallowed exception for diagnostics\ncatch (Exception e)\n{\n    Logger.LogWarning($\"传送重试异常: {e.Message}\");\n}","handlingStrategy":"try-catch","validationCode":"if (string.IsNullOrEmpty(mapName)) throw new ArgumentException(\"mapName must not be empty\");\nif (double.IsNaN(tpX) || double.IsNaN(tpY)) throw new ArgumentException(\"coordinates must be valid\");","typeGuard":null,"tryCatchPattern":"try\n{\n    await task.TpWithRetries(x, y, mapName, force);\n}\ncatch (InvalidOperationException ex) when (ex.Message == \"传送失败\")\n{\n    Logger.LogWarning($\"Teleport failed after retries for ({x}, {y}) on {mapName}: {ex.Message}\");\n    // Optionally re-initiate the teleport task or notify the user\n}","preventionTips":["Ensure the game window is focused before starting teleport tasks.","Pre-validate that target teleport points are activated in-game.","Check the logged warnings from each retry to diagnose the root cause.","Verify the game is on the correct screen (not in a dialog/loading state) before teleporting."],"tags":["teleport","retry-exhausted","game-ui","recognition"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}