OpenRA/OpenRA · error · FileNotFoundException
Required file map.yaml not present in this map
Error message
Required file map.yaml not present in this map
What it means
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.
Source
Thrown at OpenRA.Game/Map/MapPreview.cs:371
parentPackage = parent;
package = null;
}
/// <summary>
/// Updates internal state from a map and takes ownership of its package.
/// The package remains in memory and must not be disposed.
/// </summary>
public void UpdateFromMap(IReadOnlyPackage p, MapClassification classification,
MapGridType? gridType = null, MiniYamlNode[][] modDataRules = null)
{
Path = p.Name;
package = p;
Dictionary<string, MiniYaml> yaml;
using (var yamlStream = p.GetStream("map.yaml"))
{
if (yamlStream == null)
throw new FileNotFoundException("Required file map.yaml not present in this map");
yaml = new MiniYaml(null, MiniYaml.FromStream(yamlStream, $"{p.Name}:map.yaml", stringPool: cache.StringPool)).ToDictionary();
}
var newData = innerData.Clone();
newData.Class = classification;
newData.GridType = gridType ?? modData.GetOrCreate<MapGrid>().Type;
if (yaml.TryGetValue("MapFormat", out var temp))
{
var format = FieldLoader.GetValue<int>("MapFormat", temp.Value);
if (format < Map.SupportedMapFormat)
throw new InvalidDataException($"Map format {format} is not supported.");
}
if (yaml.TryGetValue("Title", out temp))
newData.Title = temp.Value;
View on GitHub (pinned to a520984d91)
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.
Defensive patterns
Strategy: validation
Validate before calling
if (!p.Contains("map.yaml"))
return; // skip preview for non-map package Try / catch
try { preview.UpdateFromMap(p, classification); }
catch (FileNotFoundException) { /* drop from preview list */ } Prevention
- 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.
When it happens
Trigger: MapPreview.UpdateFromMap: p.GetStream("map.yaml") == null. Called when the map list scans and previews candidate map packages.
Common situations: A corrupt/non-map file in the maps folder being scanned for previews; a partially-extracted .oramap.
Related errors
- Required field `{key}` not found in map.yaml
- Required file {required} not present in this map
- Required file map.yaml not present in this map
- MapFormat is not defined
- Not a valid map\n File: {package.Name}
AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13).
Data as JSON: /api/errors/e99fa5968500243a.
Report an issue: GitHub.