{"record":{"id":"7d8e0c46da72768a","repo":"OpenRA/OpenRA","slug":"could-not-open-package-name-file-not-found-or","errorCode":null,"errorMessage":"Could not open package '{name}', file not found or its format is not supported.","messagePattern":"Could not open package '(.+?)', file not found or its format is not supported\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"OpenRA.Game/FileSystem/FileSystem.cs","lineNumber":107,"sourceCode":"\n\t\t\ttry\n\t\t\t{\n\t\t\t\tIReadOnlyPackage package;\n\t\t\t\tif (name.StartsWith('$'))\n\t\t\t\t{\n\t\t\t\t\tname = name[1..];\n\n\t\t\t\t\tif (!installedMods.TryGetValue(name, out var mod))\n\t\t\t\t\t\tthrow new InvalidOperationException($\"Could not load mod '{name}'. Available mods: {installedMods.Keys.JoinWith(\", \")}\");\n\n\t\t\t\t\tpackage = mod.Package;\n\t\t\t\t\tmodPackages.Add(package);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpackage = OpenPackage(name);\n\t\t\t\t\tif (package == null)\n\t\t\t\t\t\tthrow new InvalidOperationException($\"Could not open package '{name}', file not found or its format is not supported.\");\n\t\t\t\t}\n\n\t\t\t\tMount(package, explicitName);\n\t\t\t}\n\t\t\tcatch when (optional)\n\t\t\t{\n\t\t\t}\n\t\t}\n\n\t\tpublic void Mount(IReadOnlyPackage package, string explicitName = null)\n\t\t{\n\t\t\tif (mountedPackages.TryGetValue(package, out var mountCount))\n\t\t\t{\n\t\t\t\t// Package is already mounted\n\t\t\t\t// Increment the mount count and bump up the file loading priority\n\t\t\t\tmountedPackages[package] = mountCount + 1;\n\t\t\t\tforeach (var filename in package.Contents)\n\t\t\t\t{","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/OpenRA/OpenRA/blob/a520984d91eda9de48a62b1d15c1e3bad0d4fb1a/OpenRA.Game/FileSystem/FileSystem.cs#L89-L125","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nfileSystem.Mount(\"content/main.mix\");\n// after - mark optional so missing package does not crash\nfileSystem.Mount(\"~content/main.mix\");","handlingStrategy":"validation","validationCode":"// Validate the file exists and a loader is registered before mounting\nvar fullPath = Path.Combine(Platform.EngineDir, name.TrimStart('~', '$'));\nif (!File.Exists(fullPath))\n    // skip or log; optionally use the '~' optional prefix instead","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["filesystem","package","mount","openra"],"backgroundTag":null,"analyzedSha":"a520984d91eda9de48a62b1d15c1e3bad0d4fb1a","analyzedAt":"2026-08-13T15:30:14.787Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}