EllanJiang/GameFramework · error · GameFrameworkException

Load binary ' ' from file system with internal error.

Error message

Load binary '{0}' from file system with internal error.

What it means

After reading binary data from a file system, ReadData compares the requested data length with the number of bytes LoadBinaryFromFileSystem actually wrote into the shared cache buffer. A mismatch means the resource subsystem returned fewer (or more) bytes than its own reported length — an internal consistency failure, so the provider throws this internal-error exception.

Solutions

  1. Delete local cached/variant resources and re-download the full resource package.
  2. Verify resource package integrity (rebuild with the resource editor tool so length metadata matches contents).
  3. Ensure no concurrent ReadData calls are corrupting shared state during loading.
Defensive patterns

Strategy: try-catch

Try / catch

try { dataProvider.ReadData(name, 0, null); }
catch (GameFrameworkException e) when (e.Message.StartsWith("Load binary")) { Log.Error("Corrupt binary resource '{0}' — re-download package.", name); ResourceComponent.ForceRecheckResources(); }

Prevention

When it happens

Trigger: m_ResourceManager.GetBinaryLength(dataAssetName) returns N, but LoadBinaryFromFileSystem(dataAssetName, s_CachedBytes) writes a different byte count — e.g. the file system entry was modified between the two calls, or the resource package is corrupted/partially downloaded.

Common situations: Interrupted resource download or unpack leaving a truncated binary; mixing resource versions where the length index and file system contents disagree; editing assets in the built file system manually.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at GameFramework/Base/DataProvider/DataProvider.cs:211

            HasAssetResult result = m_ResourceManager.HasAsset(dataAssetName);
            switch (result)
            {
                case HasAssetResult.AssetOnDisk:
                case HasAssetResult.AssetOnFileSystem:
                    m_ResourceManager.LoadAsset(dataAssetName, priority, m_LoadAssetCallbacks, userData);
                    break;

                case HasAssetResult.BinaryOnDisk:
                    m_ResourceManager.LoadBinary(dataAssetName, m_LoadBinaryCallbacks, userData);
                    break;

                case HasAssetResult.BinaryOnFileSystem:
                    int dataLength = m_ResourceManager.GetBinaryLength(dataAssetName);
                    EnsureCachedBytesSize(dataLength);
                    if (dataLength != m_ResourceManager.LoadBinaryFromFileSystem(dataAssetName, s_CachedBytes))
                    {
                        throw new GameFrameworkException(Utility.Text.Format("Load binary '{0}' from file system with internal error.", dataAssetName));
                    }

                    try
                    {
                        if (!m_DataProviderHelper.ReadData(m_Owner, dataAssetName, s_CachedBytes, 0, dataLength, userData))
                        {
                            throw new GameFrameworkException(Utility.Text.Format("Load data failure in data provider helper, data asset name '{0}'.", dataAssetName));
                        }

                        if (m_ReadDataSuccessEventHandler != null)
                        {
                            ReadDataSuccessEventArgs loadDataSuccessEventArgs = ReadDataSuccessEventArgs.Create(dataAssetName, 0f, userData);
                            m_ReadDataSuccessEventHandler(this, loadDataSuccessEventArgs);
                            ReferencePool.Release(loadDataSuccessEventArgs);
                        }
                    }
                    catch (Exception exception)
                    {

View on GitHub (pinned to d0c010b051)