EllanJiang/GameFramework · error · GameFrameworkException

Can not load binary ' ' from file system which is not exist.

Error message

Can not load binary '{0}' from file system which is not exist.

What it means

The synchronous LoadBinaryFromFileSystem looks up ResourceInfo for the binary asset; if it is null (the name is not in the resource index) it immediately throws a GameFrameworkException. Unlike LoadBinary, this API is synchronous and always throws — there is no failure callback path.

Solutions

  1. Verify the binary is packaged and the name matches exactly (case included) what is in the resource list.
  2. Call only after resource initialization (InitResources) has populated the resource infos.
  3. Use the async LoadBinary with failure callback if existence is uncertain, then LoadBinaryFromFileSystem only when confirmed present.
  4. Wrap the call in try-catch for GameFrameworkException and fall back to re-checking the manifest.

Example fix

// before
byte[] bytes = m_ResourceComponent.LoadBinaryFromFileSystem("cfg/data"); // never packaged
// after
if (m_ResourceComponent.HasBinaryAsset("Data/cfg.dat"))
    byte[] bytes = m_ResourceComponent.LoadBinaryFromFileSystem("Data/cfg.dat");
Defensive patterns

Strategy: try-catch

Validate before calling

if (string.IsNullOrEmpty(binaryName) || !m_ResourceComponent.CheckBinaryAsset(binaryName))
{
    Log.Warning("Binary '{0}' not present in resource index.", binaryName);
    return null;
}

Type guard

bool CanReadFromFileSystem(string name) => !string.IsNullOrEmpty(name) && m_ResourceComponent.CheckBinaryAsset(name);

Try / catch

byte[] bytes;
try { bytes = m_ResourceComponent.LoadBinaryFromFileSystem(binaryName); }
catch (GameFrameworkException ex) when (ex.Message.Contains("not exist"))
{ Log.Error("Binary {0} not packaged.", binaryName); bytes = null; }

Prevention

When it happens

Trigger: Calling LoadBinaryFromFileSystem (either overload) with a binaryAssetName that has no ResourceInfo: name never packaged, misspelled, or resource metadata not initialized yet.

Common situations: Typos in asset names; loading before resource initialization completes; binary removed from the package in a newer build while an old caller still requests it.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15). Data as JSON: /api/errors/740a830b5d7f944a. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.ResourceLoader.cs:623

                }
                else
                {
                    string path = Utility.Path.GetRemotePath(Path.Combine(resourceInfo.StorageInReadOnly ? m_ResourceManager.m_ReadOnlyPath : m_ResourceManager.m_ReadWritePath, resourceInfo.ResourceName.FullName));
                    m_ResourceManager.m_ResourceHelper.LoadBytes(path, m_LoadBytesCallbacks, LoadBinaryInfo.Create(binaryAssetName, resourceInfo, loadBinaryCallbacks, userData));
                }
            }

            /// <summary>
            /// 从文件系统中加载二进制资源。
            /// </summary>
            /// <param name="binaryAssetName">要加载二进制资源的名称。</param>
            /// <returns>存储加载二进制资源的二进制流。</returns>
            public byte[] LoadBinaryFromFileSystem(string binaryAssetName)
            {
                ResourceInfo resourceInfo = GetResourceInfo(binaryAssetName);
                if (resourceInfo == null)
                {
                    throw new GameFrameworkException(Utility.Text.Format("Can not load binary '{0}' from file system which is not exist.", binaryAssetName));
                }

                if (!resourceInfo.Ready)
                {
                    throw new GameFrameworkException(Utility.Text.Format("Can not load binary '{0}' from file system which is not ready.", binaryAssetName));
                }

                if (!resourceInfo.IsLoadFromBinary)
                {
                    throw new GameFrameworkException(Utility.Text.Format("Can not load binary '{0}' from file system which is not a binary asset.", binaryAssetName));
                }

                if (!resourceInfo.UseFileSystem)
                {
                    throw new GameFrameworkException(Utility.Text.Format("Can not load binary '{0}' from file system which is not use file system.", binaryAssetName));
                }

                IFileSystem fileSystem = m_ResourceManager.GetFileSystem(resourceInfo.FileSystemName, resourceInfo.StorageInReadOnly);

View on GitHub (pinned to d0c010b051)