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

  1. Verify the package file exists at the resolved path and the spelling in mod.yaml/Content matches exactly.
  2. Prefix the mount name with '~' if the package is optional and its absence should not abort startup.
  3. Confirm a registered IPackageLoader exists for the file's extension (the engine logs loaded loaders at startup).
  4. 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

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


AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13). Data as JSON: /api/errors/7d8e0c46da72768a. Report an issue: GitHub.