{"record":{"id":"e0f03070d3c6bf49","repo":"EllanJiang/GameFramework","slug":"can-not-load-binary-0-which-is-not-exist","errorCode":null,"errorMessage":"Can not load binary '{0}' which is not exist.","messagePattern":"Can not load binary '(.+?)' which is not exist\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.ResourceLoader.cs","lineNumber":575,"sourceCode":"            /// <summary>\n            /// 异步加载二进制资源。\n            /// </summary>\n            /// <param name=\"binaryAssetName\">要加载二进制资源的名称。</param>\n            /// <param name=\"loadBinaryCallbacks\">加载二进制资源回调函数集。</param>\n            /// <param name=\"userData\">用户自定义数据。</param>\n            public void LoadBinary(string binaryAssetName, LoadBinaryCallbacks loadBinaryCallbacks, object userData)\n            {\n                ResourceInfo resourceInfo = GetResourceInfo(binaryAssetName);\n                if (resourceInfo == null)\n                {\n                    string errorMessage = Utility.Text.Format(\"Can not load binary '{0}' which is not exist.\", binaryAssetName);\n                    if (loadBinaryCallbacks.LoadBinaryFailureCallback != null)\n                    {\n                        loadBinaryCallbacks.LoadBinaryFailureCallback(binaryAssetName, LoadResourceStatus.NotExist, errorMessage, userData);\n                        return;\n                    }\n\n                    throw new GameFrameworkException(errorMessage);\n                }\n\n                if (!resourceInfo.Ready)\n                {\n                    string errorMessage = Utility.Text.Format(\"Can not load binary '{0}' which is not ready.\", binaryAssetName);\n                    if (loadBinaryCallbacks.LoadBinaryFailureCallback != null)\n                    {\n                        loadBinaryCallbacks.LoadBinaryFailureCallback(binaryAssetName, LoadResourceStatus.NotReady, errorMessage, userData);\n                        return;\n                    }\n\n                    throw new GameFrameworkException(errorMessage);\n                }\n\n                if (!resourceInfo.IsLoadFromBinary)\n                {\n                    string errorMessage = Utility.Text.Format(\"Can not load binary '{0}' which is not a binary asset.\", binaryAssetName);\n                    if (loadBinaryCallbacks.LoadBinaryFailureCallback != null)","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.ResourceLoader.cs#L557-L593","documentation":"LoadBinary looks up the binary asset name in the resource index (ResourceInfo). If no resource with that name exists in the built resource list, GameFramework cannot load it. When no LoadBinaryFailureCallback was supplied, it throws a GameFrameworkException instead of reporting the failure through the callback.","triggerScenarios":"Calling ResourceComponent/ResourceManager LoadBinary (or LoadBinaryAsync) with a binaryAssetName that is absent from the resource package (missing from the resource list built by the resource editor / ResourceBuilder), or before the resource index has been initialized. Also thrown when the name is misspelled or the asset was not marked as a binary asset at package time.","commonSituations":"Asset name typos or case mismatch on case-sensitive platforms; forgetting to rebuild the resource package after adding a new binary file; loading during a scene change before ApplyResources/InitResources finished; stripping the binary in build rules so it is not packaged.","solutions":["Check the binaryAssetName string for typos and verify the file exists in the resource list (compare with the packaged resource list or ResourceInfos).","Rebuild/refresh the resource package so the binary is included and its ResourceInfo is generated.","Ensure resource initialization (InitResources/UpdateResources/ApplyResources) has completed before calling LoadBinary.","Always pass a LoadBinaryCallbacks with LoadBinaryFailureCallback set so failures arrive via callback instead of an exception."],"exampleFix":"// before\nm_ResourceComponent.LoadBinary(\"Configs/mydata\", onSuccess, userData); // no failure callback; name not packaged\n// after\nm_ResourceComponent.LoadBinary(\"Configs/MyData.bin\", new LoadBinaryCallbacks(OnLoadBinarySuccess, OnLoadBinaryFailure), userData);\n// and ensure the file is included and packaged into the resource list","handlingStrategy":"validation","validationCode":"// check the binary exists in the resource index before loading\nif (m_ResourceComponent == null || !m_ResourceComponent.CheckBinaryAsset(binaryName))\n{\n    Log.Warning(\"Binary '{0}' is not packaged or not initialized yet.\", binaryName);\n    return;\n}\nm_ResourceComponent.LoadBinary(binaryName, callbacks, userData);","typeGuard":"bool IsBinaryAvailable(ResourceComponent rc, string name) => rc != null && !string.IsNullOrEmpty(name) && rc.CheckBinaryAsset(name);","tryCatchPattern":"try { m_ResourceComponent.LoadBinary(binaryName, callbacks, userData); }\ncatch (GameFrameworkException ex) when (ex.Message.Contains(\"which is not exist\"))\n{ Log.Error(\"Binary {0} missing from package: {1}\", binaryName, ex.Message); }","preventionTips":["Always pass a LoadBinaryFailureCallback so failures arrive via callback, not exceptions.","Keep binary asset names in a constants file or enum, never raw strings at call sites.","Rebuild and verify the resource package after adding new binary files.","Gate loading behind resource initialization/update-complete events."],"tags":["gameframework","resource","binary","not-exist"],"backgroundTag":"resource-not-found","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}