{"record":{"id":"adda913109fd2715","repo":"OpenRA/OpenRA","slug":"unrecognized-multibrush-key-node-key-split-0","errorCode":null,"errorMessage":"Unrecognized MultiBrush key {node.Key.Split('@')[0]}","messagePattern":"Unrecognized MultiBrush key (.+?)","errorType":"exception","errorClass":"YamlException","httpStatus":null,"severity":"error","filePath":"OpenRA.Mods.Common/MapGenerator/MultiBrush.cs","lineNumber":144,"sourceCode":"\t\t\t\t\tcase \"BackingTile\":\n\t\t\t\t\t\tif (TerrainTile.TryParse(node.Value.Value, out var bt))\n\t\t\t\t\t\t\tBackingTile = bt;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tthrow new YamlException($\"Invalid MultiBrush BackingTile `{node.Value.Value}`\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"Template\":\n\t\t\t\t\t\ttemplatesAcc.Add(new TemplateInfo(node.Value));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"Tile\":\n\t\t\t\t\t\ttilesAcc.Add(new TileInfo(node.Value));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"Segment\":\n\t\t\t\t\t\tif (Segment != null)\n\t\t\t\t\t\t\tthrow new YamlException(\"Multiple MultiBrush Segment definitions\");\n\t\t\t\t\t\tSegment = new MultiBrushSegment(node.Value);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new YamlException($\"Unrecognized MultiBrush key {node.Key.Split('@')[0]}\");\n\t\t\t\t}\n\n\t\t\tActors = [.. actorsAcc];\n\t\t\tTemplates = [.. templatesAcc];\n\t\t\tTiles = [.. tilesAcc];\n\t\t}\n\n\t\tpublic static ImmutableArray<MultiBrushInfo> ParseCollection(MiniYaml my)\n\t\t{\n\t\t\tvar brushes = new List<MultiBrushInfo>();\n\t\t\tforeach (var node in my.Nodes)\n\t\t\t{\n\t\t\t\tswitch (node.Key.Split('@')[0])\n\t\t\t\t{\n\t\t\t\t\tcase \"MultiBrush\":\n\t\t\t\t\t\tbrushes.Add(new MultiBrushInfo(node.Value));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"FromTemplates\":","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/OpenRA/OpenRA/blob/a520984d91eda9de48a62b1d15c1e3bad0d4fb1a/OpenRA.Mods.Common/MapGenerator/MultiBrush.cs#L126-L162","documentation":"Thrown by MultiBrushInfo when a child node key, after stripping an @-suffix, is not one of the recognized keys (Weight, Actor, BackingTile, Template, Tile, Segment). This guards the MultiBrush schema against typos and unknown fields.","triggerScenarios":"The switch over node.Key.Split('@')[0] hits the default case.","commonSituations":"Misspelling a key (e.g., 'Templates' plural, 'Weigth'); using a key valid in a different context (e.g., a collection-level key like 'FromTemplates' inside a single brush); version mismatch where a renamed key is used; indentation placing a key at the wrong level.","solutions":["Correct the key name to one of Weight, Actor, BackingTile, Template, Tile, or Segment.","Move collection-level keys (MultiBrush, FromTemplates, FromActors) out of a single MultiBrush body.","Check spelling and pluralization against the schema."],"exampleFix":"# before\nMultiBrush:\n  Templates: 42   // wrong key -> throws\n# after\nMultiBrush:\n  Template: 42","handlingStrategy":"validation","validationCode":"var allowed = new HashSet<string> { \"Weight\", \"Actor\", \"BackingTile\", \"Template\", \"Tile\", \"Segment\" };\nforeach (var node in my.Nodes)\n    if (!allowed.Contains(node.Key.Split('@')[0]))\n        throw new YamlException($\"Unrecognized MultiBrush key '{node.Key}'.\");","typeGuard":"static readonly HashSet<string> MultiBrushKeys = new() { \"Weight\", \"Actor\", \"BackingTile\", \"Template\", \"Tile\", \"Segment\" };\nstatic bool IsValidMultiBrushKey(string key) => MultiBrushKeys.Contains(key.Split('@')[0]);","tryCatchPattern":"try { var info = new MultiBrushInfo(node.Value); }\ncatch (YamlException ex) when (ex.Message.Contains(\"Unrecognized MultiBrush key\"))\n{ /* report the unknown key */ }","preventionTips":["Restrict editor/authoring tools to the known MultiBrush key set.","Keep collection-level keys out of single-brush bodies.","Lint reduced keys against the allow-list."],"tags":["openra","yaml","map-generation","multibrush","validation","config"],"backgroundTag":null,"analyzedSha":"a520984d91eda9de48a62b1d15c1e3bad0d4fb1a","analyzedAt":"2026-08-13T15:30:14.787Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}