{"record":{"id":"744f798b0a3b16d0","repo":"ppy/osu","slug":"value-is-too-low","errorCode":null,"errorMessage":"Value is too low","messagePattern":"Value is too low","errorType":"exception","errorClass":"OverflowException","httpStatus":null,"severity":"error","filePath":"osu.Game/Beatmaps/Formats/Parsing.cs","lineNumber":22,"sourceCode":"using System;\r\nusing System.Globalization;\r\n\r\nnamespace osu.Game.Beatmaps.Formats\r\n{\r\n    /// <summary>\r\n    /// Helper methods to parse from string to number and perform very basic validation.\r\n    /// </summary>\r\n    public static class Parsing\r\n    {\r\n        public const int MAX_COORDINATE_VALUE = 131072;\r\n\r\n        public const double MAX_PARSE_VALUE = int.MaxValue;\r\n\r\n        public static float ParseFloat(string input, float parseLimit = (float)MAX_PARSE_VALUE, bool allowNaN = false)\r\n        {\r\n            float output = float.Parse(input, CultureInfo.InvariantCulture);\r\n\r\n            if (output < -parseLimit) throw new OverflowException(\"Value is too low\");\r\n            if (output > parseLimit) throw new OverflowException(\"Value is too high\");\r\n\r\n            if (!allowNaN && float.IsNaN(output)) throw new FormatException(\"Not a number\");\r\n\r\n            return output;\r\n        }\r\n\r\n        public static double ParseDouble(string input, double parseLimit = MAX_PARSE_VALUE, bool allowNaN = false)\r\n        {\r\n            double output = double.Parse(input, CultureInfo.InvariantCulture);\r\n\r\n            if (output < -parseLimit) throw new OverflowException(\"Value is too low\");\r\n            if (output > parseLimit) throw new OverflowException(\"Value is too high\");\r\n\r\n            if (!allowNaN && double.IsNaN(output)) throw new FormatException(\"Not a number\");\r\n\r\n            return output;\r\n        }\r","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/ppy/osu/blob/d9c73e12adff2feaae4a3e158d36fe5883faf6ca/osu.Game/Beatmaps/Formats/Parsing.cs#L4-L40","documentation":"Thrown by Parsing.ParseFloat when the parsed float value is less than -parseLimit (default -int.MaxValue ≈ -2.15 billion). This is a range-guard that fires after the string is successfully parsed as a float but the result is unreasonably negative for beatmap coordinate/value contexts.","triggerScenarios":"Calling Parsing.ParseFloat(input) where input parses to a float below -parseLimit. With the default limit this requires a value below roughly -2.15 billion, but callers can pass a smaller parseLimit (e.g. Parsing.MAX_COORDINATE_VALUE=131072 for storyboard sprite positions) making the threshold much lower.","commonSituations":"A storyboard sprite position or beatmap value with an extremely negative number in the .osu/.osb file; a coordinate value that exceeds the MAX_COORDINATE_VALUE limit (131072) when ParseFloat is called with that limit; data corruption or a typo adding extra digits.","solutions":["Find the value shown in the context of the error and ensure it's within the acceptable range for its field.","For coordinate values, ensure they're within ±131072 (MAX_COORDINATE_VALUE).","Clamp or correct the offending value in the .osu/.osb file.","If calling ParseFloat directly, pass an appropriate parseLimit for your use case."],"exampleFix":"// before (.osu storyboard sprite line with extreme coordinate):\n// Sprite,Background,Centre,\"img.png\",-999999999,0\n\n// after:\n// Sprite,Background,Centre,\"img.png\",0,0","handlingStrategy":"validation","validationCode":"// Validate range before calling ParseFloat\nfloat value = float.Parse(input, CultureInfo.InvariantCulture);\nif (value < -parseLimit)\n    throw new OverflowException($\"Value {value} is below the minimum of {-parseLimit}\");","typeGuard":null,"tryCatchPattern":"try\n{\n    float x = Parsing.ParseFloat(input, Parsing.MAX_COORDINATE_VALUE);\n}\ncatch (OverflowException ex) when (ex.Message == \"Value is too low\")\n{\n    Logger.Log($\"Coordinate value {input} is below minimum\", LoggingTarget.Database);\n}","preventionTips":["Sanitize numeric fields in .osu/.osb files to be within expected ranges before parsing.","Use appropriate parseLimit values when calling ParseFloat for specific field types.","Validate storyboard coordinate values against MAX_COORDINATE_VALUE (131072)."],"tags":["parsing","float","overflow","beatmap-decoding","range-error"],"backgroundTag":null,"analyzedSha":"d9c73e12adff2feaae4a3e158d36fe5883faf6ca","analyzedAt":"2026-08-13T14:12:54.015Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}