OpenRA/OpenRA · error · InvalidOperationException
Could not open package '{name}', file not found or its forma
Error message
Could not open package '{name}', file not found or its format is not supported. What it means
Thrown by FileSystem.Mount when a package name (not prefixed with '$' for a mod reference or '~' for optional) resolves to a null result from OpenPackage. OpenPackage returns null when no registered package loader recognizes the file extension or the file does not exist on disk, so the engine cannot locate a readable package for the given path.
Source
Thrown at OpenRA.Game/FileSystem/FileSystem.cs:107
try
{
IReadOnlyPackage package;
if (name.StartsWith('$'))
{
name = name[1..];
if (!installedMods.TryGetValue(name, out var mod))
throw new InvalidOperationException($"Could not load mod '{name}'. Available mods: {installedMods.Keys.JoinWith(", ")}");
package = mod.Package;
modPackages.Add(package);
}
else
{
package = OpenPackage(name);
if (package == null)
throw new InvalidOperationException($"Could not open package '{name}', file not found or its format is not supported.");
}
Mount(package, explicitName);
}
catch when (optional)
{
}
}
public void Mount(IReadOnlyPackage package, string explicitName = null)
{
if (mountedPackages.TryGetValue(package, out var mountCount))
{
// Package is already mounted
// Increment the mount count and bump up the file loading priority
mountedPackages[package] = mountCount + 1;
foreach (var filename in package.Contents)
{View on GitHub (pinned to a520984d91)
Solutions
- Verify the package file exists at the resolved path and the spelling in mod.yaml/Content matches exactly.
- Prefix the mount name with '~' if the package is optional and its absence should not abort startup.
- Confirm a registered IPackageLoader exists for the file's extension (the engine logs loaded loaders at startup).
- If the package is a mod, use the '$modid' prefix instead of a raw path so it resolves through installedMods.
Example fix
// before
fileSystem.Mount("content/main.mix");
// after - mark optional so missing package does not crash
fileSystem.Mount("~content/main.mix"); Defensive patterns
Strategy: validation
Validate before calling
// Validate the file exists and a loader is registered before mounting
var fullPath = Path.Combine(Platform.EngineDir, name.TrimStart('~', '$'));
if (!File.Exists(fullPath))
// skip or log; optionally use the '~' optional prefix instead Prevention
- Use the '~' prefix for any package mount whose absence is acceptable.
- Use the '$' prefix when the target is a mod, not a file path.
- Log installedMods.Keys and mounted packages during startup to catch missing content early.
When it happens
Trigger: Calling Mount(name) where name does not start with '$' or '~', and OpenPackage(name) returns null because the file is missing or its format is unrecognized by any IPackageLoader.
Common situations: A mod.yaml references a content package (e.g. a .mix, .zar, or .oramap) that was never extracted/downloaded; a package path typo; upgrading the engine where a package format loader was removed; missing game assets on first install.
Related errors
- Could not load mod '{name}'. Available mods: {installedMods.
- File not found: {filename}
- File not found: {f}
- Duplicate initializer '{duplicateInit.Key.Name}'
- No rules definition for unit {name}
AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13).
Data as JSON: /api/errors/7d8e0c46da72768a.
Report an issue: GitHub.