{"record":{"id":"fba72cbe67f75939","repo":"babalae/better-genshin-impact","slug":"ex-message-fba72c","errorCode":null,"errorMessage":"大地图特征点匹配引发异常：{ex.Message}","messagePattern":"大地图特征点匹配引发异常：(.+?)","errorType":"exception","errorClass":"MapPositionNotRecognizedException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs","lineNumber":2166,"sourceCode":"        else\n        {\n            throw new InvalidOperationException(\"当前不在地图界面\");\n        }\n    }\n\n    private Point2f RecognizeBigMapCenterPoint(string mapName, Mat greyMat, Point2f? expectedCenterPoint = null)\n    {\n        Point2f p;\n        try\n        {\n            var map = MapManager.GetMap(mapName, _mapMatchingMethod);\n            p = expectedCenterPoint is Point2f expectedCenter\n                ? map.GetBigMapPosition(greyMat, map.ConvertGenshinMapCoordinatesToImageCoordinates(expectedCenter))\n                : map.GetBigMapPosition(greyMat);\n        }\n        catch (Exception ex)\n        {\n            throw new MapPositionNotRecognizedException(\"大地图特征点匹配引发异常：\" + ex.Message, ex);\n        }\n\n        if (p.IsEmpty())\n        {\n            throw new MapPositionNotRecognizedException(\"大地图特征点匹配识别位置失败\");\n        }\n\n        // 提瓦特大陆由于用的256的图，需要做特殊逻辑\n        var (x, y) = (p.X, p.Y);\n        if (mapName == MapTypes.Teyvat.ToString())\n        {\n            (x, y) = (p.X * TeyvatMap.BigMap256ScaleTo2048, p.Y * TeyvatMap.BigMap256ScaleTo2048);\n        }\n\n        return MapManager.GetMap(mapName, _mapMatchingMethod).ConvertImageCoordinatesToGenshinMapCoordinates(new Point2f(x, y))!.Value;\n    }\n\n    /// <summary>","sourceCodeStart":2148,"sourceCodeEnd":2184,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs#L2148-L2184","documentation":"Thrown by RecognizeBigMapCenterPoint as a wrapper when the underlying map.GetBigMapPosition call throws any exception. The original exception is captured as the inner exception and its message is appended. This converts arbitrary matching/processing errors into a MapPositionNotRecognizedException so callers can handle recognition failures uniformly.","triggerScenarios":"Called from RecognizeBigMapCenterPoint. map.GetBigMapPosition(greyMat, ...) or map.ConvertGenshinMapCoordinatesToImageCoordinates throws — could be an OpenCV error, null reference from missing map data, argument exception from invalid coordinates, etc.","commonSituations":"Map matching assets not loaded or corrupted; OpenCV/EmguCV runtime error; the expectedCenterPoint coordinate is out of valid range for the conversion; internal data structure not initialized for the requested mapName.","solutions":["Inspect the inner exception (ex.InnerException) for the true root cause.","Ensure map assets for the specified mapName are downloaded and loaded.","Verify the OpenCV/EmguCV native libraries are correctly deployed.","Validate that expectedCenterPoint (if provided) is within the map's valid coordinate bounds.","Check logs for asset loading failures during startup."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    // RecognizeBigMapCenterPoint is private; catch at the caller level\ncatch (MapPositionNotRecognizedException ex) when (ex.Message.StartsWith(\"大地图特征点匹配引发异常\"))\n{\n    Logger.LogError($\"Feature matching threw: {ex.InnerException?.Message}\");\n    // Inspect inner exception for root cause (OpenCV error, missing asset, etc.)\n}","preventionTips":["Always inspect the InnerException to find the true root cause.","Ensure map assets and native OpenCV libraries are correctly loaded.","Validate expectedCenterPoint coordinates are within valid bounds before calling.","Check startup logs for asset loading errors."],"tags":["map-navigation","feature-matching","exception-wrapper","opencv"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}