{"record":{"id":"69b637f5b19cf52d","repo":"egametang/ET","slug":"config-create-failed-configtype-fullname","errorCode":null,"errorMessage":"config create failed: {configType.FullName}","messagePattern":"config create failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.loader/Scripts/Loader/Share/ConfigLoaderHelper.cs","lineNumber":135,"sourceCode":"                factories.Add(GetConfigGroup(factoryType), factory);\n            }\n\n            return factories;\n        }\n\n        public static ASingleton LoadOneConfig(Type configType, ConfigFactoryGroupCollection configFactories, Dictionary<Type, IConfig> loadedConfigs)\n        {\n            ConfigProcessAttribute configProcessAttribute = configType.GetCustomAttributes(typeof(ConfigProcessAttribute), false)[0] as ConfigProcessAttribute;\n            if (configProcessAttribute.ConfigType != ConfigType.Code)\n            {\n                throw new Exception($\"unsupported config type: {configProcessAttribute.ConfigType} {configType.FullName}\");\n            }\n\n            IConfigFactory factory = GetConfigFactory(configType, configFactories);\n            object category = factory.Create();\n            if (category == null)\n            {\n                throw new Exception($\"config create failed: {configType.FullName}\");\n            }\n\n            if (category.GetType() != configType)\n            {\n                throw new Exception($\"config type mismatch: expect={configType.FullName} actual={category.GetType().FullName}\");\n            }\n\n            if (category is not ASingleton singleton)\n            {\n                throw new Exception($\"config singleton invalid: {configType.FullName}\");\n            }\n\n            if (category is not IConfig iConfig)\n            {\n                throw new Exception($\"config interface invalid: {configType.FullName}\");\n            }\n\n            loadedConfigs.Add(configType, iConfig);","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.loader/Scripts/Loader/Share/ConfigLoaderHelper.cs#L117-L153","documentation":"Thrown by LoadOneConfig when IConfigFactory.Create() returns null. The factory was found and resolved (GetConfigFactory succeeded) but its Create method produced no category object. This indicates the factory's Create logic deliberately or accidentally returned null — e.g. it tried to load backing data that wasn't present.","triggerScenarios":"GetConfigFactory returned a valid factory, but factory.Create() returns null. Common when Create reads an embedded resource/asset that is missing or empty and the factory returns null instead of throwing.","commonSituations":"The config's backing data file/embedded resource was not generated or not included in the build; a codegen step produced the factory but not its data; a config that depends on another config that failed to load.","solutions":["Regenerate the config data (Luban/codegen) and ensure the output is included in the assembly/build.","Inspect the named factory's Create() to see why it returns null and fix or surface the underlying load error.","Verify embedded resources/assets for that config are present at runtime."],"exampleFix":"// before — factory returns null silently when data missing\npublic object Create()\n{\n    var data = LoadEmbedded(Name);\n    if (data == null) return null;\n    return new MyCategory(data);\n}\n\n// after — surface the real cause\npublic object Create()\n{\n    var data = LoadEmbedded(Name)\n        ?? throw new Exception($\"missing config data for {Name}\");\n    return new MyCategory(data);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { singleton = ConfigLoaderHelper.LoadOneConfig(t, factories, loaded); }\ncatch (Exception e) when (e.Message.Contains(\"config create failed\"))\n{ Log.Error($\"factory for {t.FullName} returned null; check its backing data\"); throw; }","preventionTips":["Factories should throw with a clear message when backing data is missing, not return null.","Regenerate config data (Luban) and include outputs in the build.","Add a build step that verifies config data files are present."],"tags":["loader","config","factory","create","missing-data"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}