{"record":{"id":"1d3ff920b2dab125","repo":"EllanJiang/GameFramework","slug":"appenderrormessage-uimanager","errorCode":null,"errorMessage":"appendErrorMessage","messagePattern":"appendErrorMessage","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/UI/UIManager.cs","lineNumber":1024,"sourceCode":"            }\n\n            if (m_UIFormsToReleaseOnLoad.Contains(openUIFormInfo.SerialId))\n            {\n                m_UIFormsToReleaseOnLoad.Remove(openUIFormInfo.SerialId);\n                return;\n            }\n\n            m_UIFormsBeingLoaded.Remove(openUIFormInfo.SerialId);\n            string appendErrorMessage = Utility.Text.Format(\"Load UI form failure, asset name '{0}', status '{1}', error message '{2}'.\", uiFormAssetName, status, errorMessage);\n            if (m_OpenUIFormFailureEventHandler != null)\n            {\n                OpenUIFormFailureEventArgs openUIFormFailureEventArgs = OpenUIFormFailureEventArgs.Create(openUIFormInfo.SerialId, uiFormAssetName, openUIFormInfo.UIGroup.Name, openUIFormInfo.PauseCoveredUIForm, appendErrorMessage, openUIFormInfo.UserData);\n                m_OpenUIFormFailureEventHandler(this, openUIFormFailureEventArgs);\n                ReferencePool.Release(openUIFormFailureEventArgs);\n                return;\n            }\n\n            throw new GameFrameworkException(appendErrorMessage);\n        }\n\n        private void LoadAssetUpdateCallback(string uiFormAssetName, float progress, object userData)\n        {\n            OpenUIFormInfo openUIFormInfo = (OpenUIFormInfo)userData;\n            if (openUIFormInfo == null)\n            {\n                throw new GameFrameworkException(\"Open UI form info is invalid.\");\n            }\n\n            if (m_OpenUIFormUpdateEventHandler != null)\n            {\n                OpenUIFormUpdateEventArgs openUIFormUpdateEventArgs = OpenUIFormUpdateEventArgs.Create(openUIFormInfo.SerialId, uiFormAssetName, openUIFormInfo.UIGroup.Name, openUIFormInfo.PauseCoveredUIForm, progress, openUIFormInfo.UserData);\n                m_OpenUIFormUpdateEventHandler(this, openUIFormUpdateEventArgs);\n                ReferencePool.Release(openUIFormUpdateEventArgs);\n            }\n        }\n","sourceCodeStart":1006,"sourceCodeEnd":1042,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/UI/UIManager.cs#L1006-L1042","documentation":"When a UI form fails to load and there is no OpenUIFormFailure event subscriber, UIManager has nowhere to report the failure and rethrows the accumulated error message (appendErrorMessage, built from the resource error plus a hint to check the failure event) as a GameFrameworkException. The message text is literally the underlying appendErrorMessage string.","triggerScenarios":"OpenUIForm's async load failed (missing/invalid asset, resource error) AND no handler is registered on UIComponent.OpenUIFormFailure (UnityEvent), so the exception propagates out of the load callback.","commonSituations":"Typo in UIForm asset name or form not packed into resources; running in editor without rebuilding the asset bundle/resource collection; forgetting to hook OpenUIFormFailure in game code so failures crash instead of being handled.","solutions":["Subscribe to UIComponent.OpenUIFormFailure to receive failures gracefully","Verify the uiFormAssetName matches an asset in the resource list; rebuild resource collection if it was added recently","Read the appendErrorMessage text — it contains the underlying LoadResourceStatus error","In non-Unity/framework-only tests, attach OpenUIFormFailureEventHandler before opening forms"],"exampleFix":"// before\nm_UIComponent.OpenUIForm(\"Assets/UI/BagForm\", \"Default\", userData); // throws on missing asset\n// after\nm_UIComponent.OpenUIFormFailure += (s, e) =>\n    Log.Error(\"Open form failed: {0}, {1}\", e.UIFormAssetName, e.ErrorMessage);\nm_UIComponent.OpenUIForm(\"Assets/UI/BagForm\", \"Default\", userData);","handlingStrategy":"try-catch","validationCode":"if (string.IsNullOrEmpty(assetName) || !m_ResourceComponent.HasAsset(assetName))\n{\n    Log.Error(\"UI form asset missing: {0}\", assetName);\n    return;\n}","typeGuard":null,"tryCatchPattern":"m_UIComponent.OpenUIFormFailure += (sender, e) =>\n{\n    Log.Error(\"OpenUIForm failed: {0} ({1})\", e.UIFormAssetName, e.ErrorMessage);\n};\n// and wrap opens: try { m_UIComponent.OpenUIForm(...); } catch (GameFrameworkException ex) { Log.Error(ex.Message); }","preventionTips":["Always register an OpenUIFormFailure handler before opening forms","Rebuild resource collection/bundles after adding new UI prefabs","Validate form asset names at build time with a manifest check","Log appendErrorMessage text to find the root resource error"],"tags":["unity","gameframework","ui","async","resource-loading","unhandled-failure"],"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-15T23:17:13.987Z"}