stride3d/stride · error · FileNotFoundException
Package file [ ] was not found
Error message
Package file [{filePath}] was not found What it means
Thrown by Package.LoadRaw after File.Exists failed: the resolved absolute package file path does not exist on disk, so the raw package cannot be loaded. The faulting input is the filePath argument (or a wrong current directory influencing GetAbsolutePath).
Solutions
- Check File.Exists on the resolved path before loading
- Fix the package path or restore the missing .sdpkg file
- Convert relative paths against the correct base directory
Example fix
// before
var package = Package.LoadRaw(log, "assets/Missing.sdpkg");
// after
var path = FileUtility.GetAbsolutePath("assets/Missing.sdpkg");
if (!File.Exists(path)) throw new FileNotFoundException(path);
var package = Package.LoadRaw(log, path); Defensive patterns
Strategy: validation
Validate before calling
var abs = FileUtility.GetAbsolutePath(filePath); if (!File.Exists(abs)) throw new FileNotFoundException(abs);
Try / catch
try { pkg = Package.LoadRaw(log, filePath); } catch (FileNotFoundException ex) { log.Error($"Missing package: {ex.Message}"); } Prevention
- Check File.Exists after resolving absolute path
- Keep dependent packages with the solution
- Fix base directories for relative paths
When it happens
Trigger: Calling Package.LoadRaw (or dependent load helpers) with a path to a package file that does not exist at the resolved absolute location.
Common situations: Typo in package filename; package moved/renamed after a dependency referenced it; working directory different from what a relative path assumed; dependency package not present in a fresh clone.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- File doesn't appear to be a valid package
- Unable to find the file
- Could not find bundle
- Font file not found
- Expecting relative path
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/8da37fd6be49d3e6.
Report an issue: GitHub.
Appendix: source
Thrown at sources/assets/Stride.Core.Assets/Package.cs:598
/// </summary>
/// <param name="log">The log.</param>
/// <param name="filePath">The file path.</param>
/// <returns></returns>
/// <exception cref="System.ArgumentNullException">
/// log
/// or
/// filePath
/// </exception>
internal static Package LoadRaw(ILogger log, string filePath)
{
ArgumentNullException.ThrowIfNull(log);
ArgumentNullException.ThrowIfNull(filePath);
filePath = FileUtility.GetAbsolutePath(filePath);
if (!File.Exists(filePath))
{
throw new FileNotFoundException($"Package file [{filePath}] was not found");
}
try
{
var packageFile = new PackageLoadingAssetFile(filePath, Path.GetDirectoryName(filePath)) { CachedFileSize = filePath.Length };
var context = new AssetMigrationContext(null, null, filePath, log);
AssetMigration.MigrateAssetIfNeeded(context, packageFile, "Assets");
var loadResult = packageFile.AssetContent is not null
? AssetFileSerializer.Load<Package>(new MemoryStream(packageFile.AssetContent), filePath, log)
: AssetFileSerializer.Load<Package>(filePath, log);
var package = loadResult.Asset;
package.FullPath = packageFile.FilePath;
// .sdpkg has no serialized name (identity = file name). PackageSession derives this on
// session load; do it here too so a direct Package.Load doesn't leave Meta.Name null.
if (string.IsNullOrWhiteSpace(package.Meta.Name) && package.FullPath is not null)
package.Meta.Name = package.FullPath.GetFileNameWithoutExtension();
// A package always carries a version. The session graph-walk overwrites this with theView on GitHub (pinned to 96fad776d2)