{"record":{"id":"e2d0309ecbecb183","repo":"OpenRA/OpenRA","slug":"could-not-fit-tiles-for-coast-e2d030","errorCode":null,"errorMessage":"Could not fit tiles for coast","messagePattern":"Could not fit tiles for coast","errorType":"exception","errorClass":"MapGenerationException","httpStatus":null,"severity":"error","filePath":"OpenRA.Mods.Common/Traits/World/ClassicMapGenerator.cs","lineNumber":595,"sourceCode":"\t\t\t\t\t\t\t\tmap,\n\t\t\t\t\t\t\t\tparam.SegmentedBrushes,\n\t\t\t\t\t\t\t\tbeach,\n\t\t\t\t\t\t\t\tparam.MinimumLandSeaThickness - 1,\n\t\t\t\t\t\t\t\tparam.BeachSegmentTypes[0],\n\t\t\t\t\t\t\t\tparam.BeachSegmentTypes[0])\n\t\t\t\t\t\t\t\t\t.ExtendEdge(4))\n\t\t\t\t\t.ToList();\n\t\t\t}\n\n\t\t\tvar landCoastWater = terraformer.PaintLoopsAndFill(\n\t\t\t\tcoastTilingRandom,\n\t\t\t\tcoastPaths,\n\t\t\t\tlandPlan[0] ? Terraformer.Side.In : Terraformer.Side.Out,\n\t\t\t\t[new MultiBrush().WithTemplate(map, param.WaterTile, CVec.Zero)],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t0)\n\t\t\t\t\t?? throw new MapGenerationException(\"Could not fit tiles for coast\");\n\n\t\t\tif (param.Mountains > 0)\n\t\t\t{\n\t\t\t\tvar cliffMask = MatrixUtils.CalibratedBooleanThreshold(\n\t\t\t\t\troughnessMatrix,\n\t\t\t\t\tparam.Roughness, FractionMax);\n\t\t\t\tvar cliffPlan = Matrix<bool>.Zip(landPlan, mapShape, (a, b) => a && b);\n\n\t\t\t\tfor (var altitude = 0; altitude < param.MaximumAltitude; altitude++)\n\t\t\t\t{\n\t\t\t\t\tcliffPlan = terraformer.SliceElevation(\n\t\t\t\t\t\televation,\n\t\t\t\t\t\tcliffPlan,\n\t\t\t\t\t\tparam.Mountains,\n\t\t\t\t\t\tparam.MinimumTerrainContourSpacing);\n\t\t\t\t\tcliffPlan = MatrixUtils.BooleanBlotch(\n\t\t\t\t\t\tcliffPlan,\n\t\t\t\t\t\tparam.TerrainSmoothing,","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/OpenRA/OpenRA/blob/a520984d91eda9de48a62b1d15c1e3bad0d4fb1a/OpenRA.Mods.Common/Traits/World/ClassicMapGenerator.cs#L577-L613","documentation":"Thrown when Terraformer.PaintLoopsAndFill() returns null while rendering the coastline. Coast paths (built from landPlan borders, partitioned into beach/water-cliff segments) must be tileable end-to-end and fillable; if the segment templates (BeachSegmentTypes[0], WaterCliffSegmentTypes[0]) cannot legally tile the loop set, the call returns null and generation fails.","triggerScenarios":"Coast geometry produced by the land/water plan that no valid beach/water-cliff tile sequence can cover; WaterRoughness > 0 producing partitioned zones whose segment types are missing or incomplete in the tileset.","commonSituations":"Tileset lacks complete beach or water-cliff templates; MinimumLandSeaThickness too small for the brush; MinimumCoastStraight or MinimumBeachLength constraints incompatible with available tiles.","solutions":["Verify BeachSegmentTypes[0] (and WaterCliffSegmentTypes[0] when WaterRoughness>0) map to complete tile templates in the tileset.","Increase MinimumLandSeaThickness so the coast brush has room.","Lower WaterRoughness to 0 to use the simpler single-segment beach path branch.","Raise MinimumBeachLength tolerance only if templates genuinely support longer runs."],"exampleFix":"// before\nWater: 50\nWaterRoughness: 50   // activates water-cliff partitioning\n// after (simplify coast)\nWaterRoughness: 0","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* generate map */ }\ncatch (MapGenerationException ex) when (ex.Message.Contains(\"coast\"))\n{ /* retry with WaterRoughness: 0 or larger MinimumLandSeaThickness, or report missing beach templates */ }","preventionTips":["Ensure beach and water-cliff templates are complete in the tileset before enabling WaterRoughness.","Validate segment-type references resolve to real templates during mod build.","Keep MinimumLandSeaThickness >= brush requirement for the coast path."],"tags":["map-generation","tiling","tileset","coast","openra"],"backgroundTag":null,"analyzedSha":"a520984d91eda9de48a62b1d15c1e3bad0d4fb1a","analyzedAt":"2026-08-13T15:30:14.787Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}