{"record":{"id":"93099f16169fbeed","repo":"OpenRA/OpenRA","slug":"expansionborder-must-be-1","errorCode":null,"errorMessage":"ExpansionBorder must be >= 1","messagePattern":"ExpansionBorder must be >= 1","errorType":"exception","errorClass":"MapGenerationException","httpStatus":null,"severity":"error","filePath":"OpenRA.Mods.Common/Traits/World/ClassicMapGenerator.cs","lineNumber":381,"sourceCode":"\t\t\t\t\tthrow new MapGenerationException(\"SpawnReservation must be >= 1\");\n\t\t\t\tif (SpawnBuildSize < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"SpawnBuildSize must be >= 1\");\n\t\t\t\tif (MinimumSpawnRadius < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"MinimumSpawnRadius must be >= 1\");\n\t\t\t\tif (SpawnResourceSpawns < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"SpawnResourceSpawns must be >= 0\");\n\t\t\t\tif (ResourceSpawnReservation < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"ResourceSpawnReservation must be >= 1\");\n\t\t\t\tif (MaximumExpansionResourceSpawns < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"MaximumExpansionResourceSpawns must be >= 0\");\n\t\t\t\tif (MinimumExpansionSize < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"MinimumExpansionSize must be >= 1\");\n\t\t\t\tif (MaximumExpansionSize < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"MaximumExpansionSize must be >= 1\");\n\t\t\t\tif (MinimumExpansionSize > MaximumExpansionSize)\n\t\t\t\t\tthrow new MapGenerationException(\"MinimumExpansionSize must be <= maximumExpansionSize\");\n\t\t\t\tif (ExpansionBorder < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"ExpansionBorder must be >= 1\");\n\t\t\t\tif (ExpansionInner < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"ExpansionInner must be >= 1\");\n\t\t\t\tif (MaximumResourceSpawnsPerExpansion < 1)\n\t\t\t\t\tthrow new MapGenerationException(\"MaximumResourceSpawnsPerExpansion must be >= 1\");\n\t\t\t\tif (MinimumBuildings < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"MinimumBuildings must be >= 0\");\n\t\t\t\tif (MaximumBuildings < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"MaximumBuildings must be >= 0\");\n\t\t\t\tif (MinimumBuildings > MaximumBuildings)\n\t\t\t\t\tthrow new MapGenerationException(\"MinimumBuildings must be <= maximumBuildings\");\n\t\t\t\tif (CivilianBuildings < 0 || CivilianBuildings > FractionMax)\n\t\t\t\t\tthrow new MapGenerationException($\"CivilianBuildings must be between 0 and {FractionMax} inclusive\");\n\t\t\t\tif (CivilianBuildingDensity < 0 || CivilianBuildingDensity > FractionMax)\n\t\t\t\t\tthrow new MapGenerationException($\"CivilianBuildingDensity must be between 0 and {FractionMax} inclusive\");\n\t\t\t\tif (MinimumCivilianBuildingDensity < 0 || MinimumCivilianBuildingDensity > FractionMax)\n\t\t\t\t\tthrow new MapGenerationException($\"MinimumCivilianBuildingDensity must be between 0 and {FractionMax} inclusive\");\n\t\t\t\tif (CivilianBuildingDensityRadius < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"CivilianBuildingDensityRadius must be >= 0\");","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/OpenRA/OpenRA/blob/a520984d91eda9de48a62b1d15c1e3bad0d4fb1a/OpenRA.Mods.Common/Traits/World/ClassicMapGenerator.cs#L363-L399","documentation":"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.","triggerScenarios":"Running map generation with the ExpansionBorder yaml field set to 0, negative, or left at the FieldLoader.Require default of 0.","commonSituations":"Authoring a generator rule and omitting ExpansionBorder, or setting it to 0 to disable borders (not supported — borders are mandatory for the expansion algorithm).","solutions":["Set ExpansionBorder to a positive integer (commonly 1-3) in the generator yaml.","Keep it smaller than ExpansionInner + MaximumExpansionSize to avoid border dominating the zone."],"exampleFix":"# before\nExpansionBorder: 0\n# after\nExpansionBorder: 2","handlingStrategy":"validation","validationCode":"if (param.ExpansionBorder < 1)\n    throw new InvalidOperationException(\"ExpansionBorder must be >= 1\");","typeGuard":"static bool ExpansionBorderOk(ClassicMapGeneratorInfo.Parameters p) => p.ExpansionBorder >= 1;","tryCatchPattern":"try { mapGenerator.Generate(modData, args); }\ncatch (MapGenerationException ex) when (ex.Message.Contains(\"ExpansionBorder\"))\n{ /* set ExpansionBorder to a positive integer */ }","preventionTips":["Borders are mandatory; never set ExpansionBorder to 0.","Reference a known-good generator yaml when authoring a new one."],"tags":["openra","map-generation","yaml-config","validation","config-error"],"backgroundTag":null,"analyzedSha":"a520984d91eda9de48a62b1d15c1e3bad0d4fb1a","analyzedAt":"2026-08-13T15:30:14.787Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}