{"record":{"id":"e99fa5968500243a","repo":"OpenRA/OpenRA","slug":"required-file-map-yaml-not-present-in-this-map-e99fa5","errorCode":null,"errorMessage":"Required file map.yaml not present in this map","messagePattern":"Required file map\\.yaml not present in this map","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"OpenRA.Game/Map/MapPreview.cs","lineNumber":371,"sourceCode":"\t\t\tparentPackage = parent;\n\t\t\tpackage = null;\n\t\t}\n\n\t\t/// <summary>\n\t\t/// Updates internal state from a map and takes ownership of its package.\n\t\t/// The package remains in memory and must not be disposed.\n\t\t/// </summary>\n\t\tpublic void UpdateFromMap(IReadOnlyPackage p, MapClassification classification,\n\t\t\tMapGridType? gridType = null, MiniYamlNode[][] modDataRules = null)\n\t\t{\n\t\t\tPath = p.Name;\n\t\t\tpackage = p;\n\n\t\t\tDictionary<string, MiniYaml> yaml;\n\t\t\tusing (var yamlStream = p.GetStream(\"map.yaml\"))\n\t\t\t{\n\t\t\t\tif (yamlStream == null)\n\t\t\t\t\tthrow new FileNotFoundException(\"Required file map.yaml not present in this map\");\n\n\t\t\t\tyaml = new MiniYaml(null, MiniYaml.FromStream(yamlStream, $\"{p.Name}:map.yaml\", stringPool: cache.StringPool)).ToDictionary();\n\t\t\t}\n\n\t\t\tvar newData = innerData.Clone();\n\t\t\tnewData.Class = classification;\n\t\t\tnewData.GridType = gridType ?? modData.GetOrCreate<MapGrid>().Type;\n\n\t\t\tif (yaml.TryGetValue(\"MapFormat\", out var temp))\n\t\t\t{\n\t\t\t\tvar format = FieldLoader.GetValue<int>(\"MapFormat\", temp.Value);\n\t\t\t\tif (format < Map.SupportedMapFormat)\n\t\t\t\t\tthrow new InvalidDataException($\"Map format {format} is not supported.\");\n\t\t\t}\n\n\t\t\tif (yaml.TryGetValue(\"Title\", out temp))\n\t\t\t\tnewData.Title = temp.Value;\n","sourceCodeStart":353,"sourceCodeEnd":389,"githubUrl":"https://github.com/OpenRA/OpenRA/blob/a520984d91eda9de48a62b1d15c1e3bad0d4fb1a/OpenRA.Game/Map/MapPreview.cs#L353-L389","documentation":"MapPreview.UpdateFromMap opens map.yaml from the package to read preview metadata. If GetStream returns null the package has no map.yaml and the preview cannot be built.","triggerScenarios":"MapPreview.UpdateFromMap: p.GetStream(\"map.yaml\") == null. Called when the map list scans and previews candidate map packages.","commonSituations":"A corrupt/non-map file in the maps folder being scanned for previews; a partially-extracted .oramap.","solutions":["Remove or repair corrupt/non-map files from the maps folder.","Confirm the package contains map.yaml before previewing.","Filter the preview scan to packages that contain map.yaml."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!p.Contains(\"map.yaml\"))\n    return; // skip preview for non-map package","typeGuard":null,"tryCatchPattern":"try { preview.UpdateFromMap(p, classification); }\ncatch (FileNotFoundException) { /* drop from preview list */ }","preventionTips":["Filter the maps folder to packages containing map.yaml before previewing.","Remove corrupt/non-map files from the maps directory.","Treat preview failures as soft skips."],"tags":["map","preview","map-yaml","validation"],"backgroundTag":null,"analyzedSha":"a520984d91eda9de48a62b1d15c1e3bad0d4fb1a","analyzedAt":"2026-08-13T15:30:14.787Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}