OpenRA/OpenRA · error · MapGenerationException

ExpansionBorder must be >= 1

Error message

ExpansionBorder must be >= 1

What it means

Thrown when ExpansionBorder is less than 1. ExpansionBorder defines the ring thickness of border cells around each expansion area used by the zone/terrain brush logic; zero or negative makes the border math produce empty regions, so it must be at least one cell.

Source

Thrown at OpenRA.Mods.Common/Traits/World/ClassicMapGenerator.cs:381

					throw new MapGenerationException("SpawnReservation must be >= 1");
				if (SpawnBuildSize < 1)
					throw new MapGenerationException("SpawnBuildSize must be >= 1");
				if (MinimumSpawnRadius < 1)
					throw new MapGenerationException("MinimumSpawnRadius must be >= 1");
				if (SpawnResourceSpawns < 0)
					throw new MapGenerationException("SpawnResourceSpawns must be >= 0");
				if (ResourceSpawnReservation < 1)
					throw new MapGenerationException("ResourceSpawnReservation must be >= 1");
				if (MaximumExpansionResourceSpawns < 0)
					throw new MapGenerationException("MaximumExpansionResourceSpawns must be >= 0");
				if (MinimumExpansionSize < 1)
					throw new MapGenerationException("MinimumExpansionSize must be >= 1");
				if (MaximumExpansionSize < 1)
					throw new MapGenerationException("MaximumExpansionSize must be >= 1");
				if (MinimumExpansionSize > MaximumExpansionSize)
					throw new MapGenerationException("MinimumExpansionSize must be <= maximumExpansionSize");
				if (ExpansionBorder < 1)
					throw new MapGenerationException("ExpansionBorder must be >= 1");
				if (ExpansionInner < 1)
					throw new MapGenerationException("ExpansionInner must be >= 1");
				if (MaximumResourceSpawnsPerExpansion < 1)
					throw new MapGenerationException("MaximumResourceSpawnsPerExpansion must be >= 1");
				if (MinimumBuildings < 0)
					throw new MapGenerationException("MinimumBuildings must be >= 0");
				if (MaximumBuildings < 0)
					throw new MapGenerationException("MaximumBuildings must be >= 0");
				if (MinimumBuildings > MaximumBuildings)
					throw new MapGenerationException("MinimumBuildings must be <= maximumBuildings");
				if (CivilianBuildings < 0 || CivilianBuildings > FractionMax)
					throw new MapGenerationException($"CivilianBuildings must be between 0 and {FractionMax} inclusive");
				if (CivilianBuildingDensity < 0 || CivilianBuildingDensity > FractionMax)
					throw new MapGenerationException($"CivilianBuildingDensity must be between 0 and {FractionMax} inclusive");
				if (MinimumCivilianBuildingDensity < 0 || MinimumCivilianBuildingDensity > FractionMax)
					throw new MapGenerationException($"MinimumCivilianBuildingDensity must be between 0 and {FractionMax} inclusive");
				if (CivilianBuildingDensityRadius < 0)
					throw new MapGenerationException("CivilianBuildingDensityRadius must be >= 0");

View on GitHub (pinned to a520984d91)

Solutions

  1. Set ExpansionBorder to a positive integer (commonly 1-3) in the generator yaml.
  2. Keep it smaller than ExpansionInner + MaximumExpansionSize to avoid border dominating the zone.

Example fix

# before
ExpansionBorder: 0
# after
ExpansionBorder: 2
Defensive patterns

Strategy: validation

Validate before calling

if (param.ExpansionBorder < 1)
    throw new InvalidOperationException("ExpansionBorder must be >= 1");

Type guard

static bool ExpansionBorderOk(ClassicMapGeneratorInfo.Parameters p) => p.ExpansionBorder >= 1;

Try / catch

try { mapGenerator.Generate(modData, args); }
catch (MapGenerationException ex) when (ex.Message.Contains("ExpansionBorder"))
{ /* set ExpansionBorder to a positive integer */ }

Prevention

When it happens

Trigger: Running map generation with the ExpansionBorder yaml field set to 0, negative, or left at the FieldLoader.Require default of 0.

Common situations: Authoring a generator rule and omitting ExpansionBorder, or setting it to 0 to disable borders (not supported — borders are mandatory for the expansion algorithm).

Related errors


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