{"record":{"id":"6a577d58f8c4e1b6","repo":"OpenRA/OpenRA","slug":"oreuniformity-must-be-0","errorCode":null,"errorMessage":"OreUniformity must be >= 0","messagePattern":"OreUniformity must be >= 0","errorType":"exception","errorClass":"MapGenerationException","httpStatus":null,"severity":"error","filePath":"OpenRA.Mods.Common/Traits/World/ClassicMapGenerator.cs","lineNumber":403,"sourceCode":"\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\");\n\t\t\t\tif (ResourcesPerPlayer < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"ResourcesPerPlayer must be >= 0\");\n\t\t\t\tif (OreUniformity < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"OreUniformity must be >= 0\");\n\t\t\t\tif (OreClumpiness < 0)\n\t\t\t\t\tthrow new MapGenerationException(\"OreClumpiness must be >= 0\");\n\t\t\t\tforeach (var kv in BuildingWeights)\n\t\t\t\t\tif (kv.Value < 0)\n\t\t\t\t\t\tthrow new MapGenerationException(\"BuildingWeights.* must be >= 0\");\n\t\t\t\tforeach (var kv in ResourceSpawnWeights)\n\t\t\t\t\tif (kv.Value < 0)\n\t\t\t\t\t\tthrow new MapGenerationException(\"ResourceSpawnWeights.* must be >= 0\");\n\t\t\t\tforeach (var kv in ResourceSpawnWeights)\n\t\t\t\t\tif (!ResourceSpawnSeeds.ContainsKey(kv.Key))\n\t\t\t\t\t\tthrow new MapGenerationException($\"ResourceSpawnSeeds does not contain possible resource spawn `{kv.Key}`\");\n\n\t\t\t\tif (!(terrainInfo.Templates.TryGetValue(LandTile, out var landTemplate) && landTemplate.Contains(0)))\n\t\t\t\t\tthrow new MapGenerationException(\"LandTile is not valid\");\n\t\t\t\tif (!(terrainInfo.Templates.TryGetValue(LandTile, out var waterTemplate) && waterTemplate.Contains(0)))\n\t\t\t\t\tthrow new MapGenerationException(\"WaterTile is not valid\");\n\n\t\t\t\tif (Players > 32)","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/OpenRA/OpenRA/blob/a520984d91eda9de48a62b1d15c1e3bad0d4fb1a/OpenRA.Mods.Common/Traits/World/ClassicMapGenerator.cs#L385-L421","documentation":"Thrown when OreUniformity is negative. OreUniformity controls how uniformly ore is spread (higher = more even distribution, lower = patchier); negative values break the resource-generation weighting. Zero is permitted.","triggerScenarios":"Map generation with the OreUniformity yaml field set to a negative integer.","commonSituations":"Sign error or typo; confusion with the 0-1000 fraction fields (this one is a plain non-negative scalar, not a fraction).","solutions":["Set OreUniformity to 0 or a positive integer.","Increase it for smoother ore fields, decrease toward 0 for clumpier ore."],"exampleFix":"# before\nOreUniformity: -5\n# after\nOreUniformity: 10","handlingStrategy":"validation","validationCode":"if (param.OreUniformity < 0)\n    throw new InvalidOperationException(\"OreUniformity must be >= 0\");","typeGuard":"static bool OreUniformityOk(ClassicMapGeneratorInfo.Parameters p) => p.OreUniformity >= 0;","tryCatchPattern":"try { mapGenerator.Generate(modData, args); }\ncatch (MapGenerationException ex) when (ex.Message.Contains(\"OreUniformity\"))\n{ /* use 0 or a positive scalar */ }","preventionTips":["OreUniformity is a non-negative scalar, not a 0-1000 fraction.","Raise for smoother ore, lower toward 0 for patchier ore."],"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"}