{"record":{"id":"5546240d74041135","repo":"ppy/osu","slug":"color-specified-in-incorrect-format-should-be-r-g","errorCode":null,"errorMessage":"Color specified in incorrect format (should be R,G,B or R,G,B,A): {pair.Value}","messagePattern":"Color specified in incorrect format \\(should be R,G,B or R,G,B,A\\): (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"osu.Game/Beatmaps/Formats/LegacyDecoder.cs","lineNumber":109,"sourceCode":"                case Section.Colours:\r\n                    HandleColours(output, line, false);\r\n                    return;\r\n            }\r\n        }\r\n\r\n        protected string StripComments(string line)\r\n        {\r\n            int index = line.AsSpan().IndexOf(\"//\".AsSpan());\r\n            if (index > 0)\r\n                return line.Substring(0, index);\r\n\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","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/ppy/osu/blob/d9c73e12adff2feaae4a3e158d36fe5883faf6ca/osu.Game/Beatmaps/Formats/LegacyDecoder.cs#L91-L127","documentation":"Thrown by LegacyDecoder.convertSettingStringToColor4 when a colour specification line doesn't split into exactly 3 or 4 comma-separated components. The expected format is 'R,G,B' or 'R,G,B,A'. Having fewer than 3 or more than 4 values triggers this before any parsing is attempted.","triggerScenarios":"Decoding a .osu/.osb file where a colour line in [Colours] (or a ComboN colour) has the wrong number of comma-separated values — e.g. 'Combo1 : 255' (1 value), 'Combo1 : 255,0,0,0,0' (5 values), or an empty value field.","commonSituations":"Manual editing of a .osu file where a colour line is truncated or has extra values; a buggy skin/beatmap editor that writes malformed colour strings; a copy-paste error introducing extra commas.","solutions":["Inspect the colour line shown in the error message and ensure it has exactly 3 (R,G,B) or 4 (R,G,B,A) integer values.","Fix the .osu/.osb file's [Colours] section: e.g. change 'Combo1 : 255,0,0' (valid) instead of 'Combo1 : 255,0' (invalid).","Re-export the beatmap/skin from a working editor if the file is extensively corrupted."],"exampleFix":"// before (.osu [Colours] section):\n// Combo1 : 255,128\n\n// after:\n// Combo1 : 255,128,0","handlingStrategy":"validation","validationCode":"// Validate colour format before parsing\nstring[] split = pair.Value.Split(',');\nif (split.Length != 3 && split.Length != 4)\n    throw new InvalidOperationException($\"Invalid colour format: expected 3 or 4 components, got {split.Length}\");","typeGuard":null,"tryCatchPattern":"try\n{\n    decoder.Decode(reader);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"incorrect format\"))\n{\n    Logger.Log($\"Malformed colour line in beatmap: {ex.Message}\", LoggingTarget.Database);\n}","preventionTips":["If editing .osu files by hand, always use exactly 3 (R,G,B) or 4 (R,G,B,A) comma-separated values for colours.","Validate colour strings programmatically before writing to .osu files.","Use a beatmap editor that correctly formats colour values."],"tags":["beatmap-decoding","color","format-error","data-corruption"],"backgroundTag":null,"analyzedSha":"d9c73e12adff2feaae4a3e158d36fe5883faf6ca","analyzedAt":"2026-08-13T14:12:54.015Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}