{"record":{"id":"1fdb3afa03f8f9a1","repo":"PrismLibrary/Prism","slug":"one-or-more-errors-were-encountered-while-configuring-the","errorCode":null,"errorMessage":"One or more errors were encountered while configuring the Module Catalog","messagePattern":"One or more errors were encountered while configuring the Module Catalog","errorType":"exception","errorClass":"AggregateException","httpStatus":null,"severity":"critical","filePath":"src/Maui/Prism.Maui/PrismAppBuilder.cs","lineNumber":212,"sourceCode":"        {\n            try\n            {\n                action(_container);\n            }\n            catch (Exception ex)\n            {\n                logger.LogError(ex, \"Error executing Module Catalog Configuration Delegate.\");\n                errors.Add(ex);\n            }\n        });\n\n        if (errors.Count == 1)\n        {\n            throw new PrismInitializationException(\"An error was encountered while configuring the Module Catalog\", errors[0]);\n        }\n        else if (errors.Count > 1)\n        {\n            throw new AggregateException(\"One or more errors were encountered while configuring the Module Catalog\", [.. errors]);\n        }\n\n        // Phase 2: Initialize modules so their services are registered\n        if (_container.IsRegistered<IModuleCatalog>() && _container.Resolve<IModuleCatalog>().Modules.Any())\n        {\n            try\n            {\n                logger.LogDebug(\"Initializing modules.\");\n                var manager = _container.Resolve<IModuleManager>();\n                manager.Run();\n                logger.LogDebug(\"Modules Initialized.\");\n            }\n            catch (Exception ex)\n            {\n                logger.LogError(ex, \"An error ocurred while initializing the Modules.\");\n                throw new PrismInitializationException(\"An error occurred while initializing the Modules.\", ex);\n            }\n        }","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Maui/Prism.Maui/PrismAppBuilder.cs#L194-L230","documentation":"If more than one exception is collected while configuring the Module Catalog during Prism initialization, Prism aggregates them and throws an AggregateException with this message. It means multiple modules failed their catalog configuration in the same startup pass.","triggerScenarios":"Two or more AddModule registrations (or module catalog configuration delegates) throwing during OnInitialized — e.g. multiple module assemblies that fail to load or multiple modules whose catalog setup throws.","commonSituations":"App-wide startup breakage after a rename/refactor touching several modules; missing several module assemblies in the deployment; container registration failures across multiple modules.","solutions":["Enumerate the InnerExceptions of the AggregateException to list every failing module.","Fix each module's registration/assembly reference; fix the shared root cause if all fail for the same reason (e.g. missing shared dependency).","Temporarily register modules one at a time to bisect which ones are broken.","Ensure all module assemblies ship in the app package and types are public."],"exampleFix":"// before: two broken registrations\nmoduleCatalog.AddModule<BillingModule>();\nmoduleCatalog.AddModule<ReportingModule>();\n// after: verify both assemblies referenced and types exist, or remove the ones not shipped\nmoduleCatalog.AddModule<BillingModule>();","handlingStrategy":"validation","validationCode":"var failing = modules.Where(m => Assembly.Load(m.AssemblyName) == null).ToList();\nif (failing.Any()) throw new InvalidOperationException($\"Missing assemblies: {string.Join(\",\", failing)}\");","typeGuard":null,"tryCatchPattern":"try\n{\n    OnInitialized();\n}\ncatch (AggregateException ex)\n{\n    foreach (var inner in ex.InnerExceptions)\n        logger.LogError(inner, \"Module catalog error\");\n}","preventionTips":["Fix the shared root cause when multiple modules fail together.","Register modules incrementally so regressions surface one at a time.","Verify deployment packaging includes every module assembly."],"tags":["dotnet","maui","prism","modules","startup","aggregate"],"backgroundTag":"module-init-failed","analyzedSha":"358118cd640d9a22ff8cf21c8ad197fa038b7990","analyzedAt":"2026-09-15T15:00:31.079Z","contentChangedAt":"2026-09-15T15:00:31.079Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}