OpenRA/OpenRA · error · YamlException

Unrecognized MultiBrush key {node.Key.Split('@')[0]}

Error message

Unrecognized MultiBrush key {node.Key.Split('@')[0]}

What it means

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.

Source

Thrown at OpenRA.Mods.Common/MapGenerator/MultiBrush.cs:144

					case "BackingTile":
						if (TerrainTile.TryParse(node.Value.Value, out var bt))
							BackingTile = bt;
						else
							throw new YamlException($"Invalid MultiBrush BackingTile `{node.Value.Value}`");
						break;
					case "Template":
						templatesAcc.Add(new TemplateInfo(node.Value));
						break;
					case "Tile":
						tilesAcc.Add(new TileInfo(node.Value));
						break;
					case "Segment":
						if (Segment != null)
							throw new YamlException("Multiple MultiBrush Segment definitions");
						Segment = new MultiBrushSegment(node.Value);
						break;
					default:
						throw new YamlException($"Unrecognized MultiBrush key {node.Key.Split('@')[0]}");
				}

			Actors = [.. actorsAcc];
			Templates = [.. templatesAcc];
			Tiles = [.. tilesAcc];
		}

		public static ImmutableArray<MultiBrushInfo> ParseCollection(MiniYaml my)
		{
			var brushes = new List<MultiBrushInfo>();
			foreach (var node in my.Nodes)
			{
				switch (node.Key.Split('@')[0])
				{
					case "MultiBrush":
						brushes.Add(new MultiBrushInfo(node.Value));
						break;
					case "FromTemplates":

View on GitHub (pinned to a520984d91)

Solutions

  1. Correct the key name to one of Weight, Actor, BackingTile, Template, Tile, or Segment.
  2. Move collection-level keys (MultiBrush, FromTemplates, FromActors) out of a single MultiBrush body.
  3. Check spelling and pluralization against the schema.

Example fix

# before
MultiBrush:
  Templates: 42   // wrong key -> throws
# after
MultiBrush:
  Template: 42
Defensive patterns

Strategy: validation

Validate before calling

var allowed = new HashSet<string> { "Weight", "Actor", "BackingTile", "Template", "Tile", "Segment" };
foreach (var node in my.Nodes)
    if (!allowed.Contains(node.Key.Split('@')[0]))
        throw new YamlException($"Unrecognized MultiBrush key '{node.Key}'.");

Type guard

static readonly HashSet<string> MultiBrushKeys = new() { "Weight", "Actor", "BackingTile", "Template", "Tile", "Segment" };
static bool IsValidMultiBrushKey(string key) => MultiBrushKeys.Contains(key.Split('@')[0]);

Try / catch

try { var info = new MultiBrushInfo(node.Value); }
catch (YamlException ex) when (ex.Message.Contains("Unrecognized MultiBrush key"))
{ /* report the unknown key */ }

Prevention

When it happens

Trigger: The switch over node.Key.Split('@')[0] hits the default case.

Common situations: 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.

Related errors


AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13). Data as JSON: /api/errors/adda913109fd2715. Report an issue: GitHub.