{"record":{"id":"a216ed347ad356e3","repo":"ppy/osu","slug":"color-must-be-specified-with-8-bit-integer-compone","errorCode":null,"errorMessage":"Color must be specified with 8-bit integer components","messagePattern":"Color must be specified with 8-bit integer components","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"osu.Game/Beatmaps/Formats/LegacyDecoder.cs","lineNumber":120,"sourceCode":"\r\n            return line;\r\n        }\r\n\r\n        private Color4 convertSettingStringToColor4(string[] split, bool allowAlpha, KeyValuePair<string, string> pair)\r\n        {\r\n            if (split.Length != 3 && split.Length != 4)\r\n                throw new InvalidOperationException($@\"Color specified in incorrect format (should be R,G,B or R,G,B,A): {pair.Value}\");\r\n\r\n            Color4 colour;\r\n\r\n            try\r\n            {\r\n                byte alpha = allowAlpha && split.Length == 4 ? byte.Parse(split[3]) : (byte)255;\r\n                colour = new Color4(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]), alpha);\r\n            }\r\n            catch\r\n            {\r\n                throw new InvalidOperationException(@\"Color must be specified with 8-bit integer components\");\r\n            }\r\n\r\n            return colour;\r\n        }\r\n\r\n        protected void HandleColours<TModel>(TModel output, string line, bool allowAlpha)\r\n        {\r\n            var pair = SplitKeyVal(line);\r\n\r\n            string[] split = pair.Value.Split(',');\r\n            Color4 colour = convertSettingStringToColor4(split, allowAlpha, pair);\r\n\r\n            bool isCombo = pair.Key.StartsWith(@\"Combo\", StringComparison.Ordinal)\r\n                           && int.TryParse(pair.Key[5..], out int comboIndex)\r\n                           && comboIndex >= 1 && comboIndex <= MAX_COMBO_COLOUR_COUNT;\r\n\r\n            if (isCombo)\r\n            {\r","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/ppy/osu/blob/d9c73e12adff2feaae4a3e158d36fe5883faf6ca/osu.Game/Beatmaps/Formats/LegacyDecoder.cs#L102-L138","documentation":"Thrown by LegacyDecoder.convertSettingStringToColor4 when the colour string has the correct number of components (3 or 4) but one or more components cannot be parsed as a byte (0–255 unsigned integer). The inner try/catch around byte.Parse catches any format or overflow exception and re-throws this message.","triggerScenarios":"Decoding a .osu/.osb file where a colour line has the right number of values but at least one isn't a valid 8-bit unsigned integer — e.g. 'Combo1 : 255,0,300' (300 > 255), 'Combo1 : 255,0,red' (non-numeric), 'Combo1 : 255.5,0,0' (floating point), or 'Combo1 : -1,0,0' (negative).","commonSituations":"Manual editing with floating-point or out-of-range colour values; a skin editor that allows out-of-gamut colour values; decimal colour values from a conversion tool that weren't rounded to integers.","solutions":["Inspect the colour line and ensure every component is an integer between 0 and 255 inclusive.","Round or clamp any floating-point values: '255.5' → '255' or '256'.","Clamp out-of-range values: '300' → '255', '-1' → '0'.","Remove any non-numeric text from the colour fields."],"exampleFix":"// before (.osu [Colours] section):\n// Combo1 : 255,0,300\n// Combo2 : 255.5,0,0\n\n// after:\n// Combo1 : 255,0,255\n// Combo2 : 255,0,0","handlingStrategy":"try-catch","validationCode":"// Validate each colour component is a valid byte\nstring[] split = pair.Value.Split(',');\nforeach (string s in split)\n{\n    if (!byte.TryParse(s, out _))\n        throw new InvalidOperationException($\"Colour component '{s}' is not a valid 8-bit integer\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    decoder.Decode(reader);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"8-bit integer components\"))\n{\n    Logger.Log($\"Colour value out of byte range in beatmap: {ex.Message}\", LoggingTarget.Database);\n}","preventionTips":["Ensure all colour components are integers between 0 and 255 inclusive.","Round floating-point colour values before writing them to .osu files.","Clamp out-of-range values before serialization."],"tags":["beatmap-decoding","color","parse-error","data-corruption"],"backgroundTag":null,"analyzedSha":"d9c73e12adff2feaae4a3e158d36fe5883faf6ca","analyzedAt":"2026-08-13T14:12:54.015Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}