{"record":{"id":"7f4128c5f7d11f4a","repo":"aspnetboilerplate/aspnetboilerplate","slug":"input-types-must-be-unique-there-is-already-an-inp","errorCode":null,"errorMessage":"Input types must be unique.There is already an input type named \\\"{inputTypeName}\\\"","messagePattern":"Input types must be unique\\.There is already an input type named \\\\\"(.+?)\\\\\"","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Abp/DynamicEntityProperties/DynamicEntityPropertyDefinitionManager.cs","lineNumber":57,"sourceCode":"                using (var provider = _iocManager.ResolveAsDisposable<DynamicEntityPropertyDefinitionProvider>(providerType))\n                {\n                    provider.Object.SetDynamicEntityProperties(context);\n                }\n            }\n        }\n\n        public void AddAllowedInputType<TInputType>() where TInputType : IInputType\n        {\n            var inputTypeName = InputTypeBase.GetName<TInputType>();\n\n            if (inputTypeName.IsNullOrWhiteSpace())\n            {\n                throw new ArgumentNullException(typeof(TInputType).FullName + \"/\" + nameof(inputTypeName));\n            }\n\n            if (_allowedInputTypes.ContainsKey(inputTypeName))\n            {\n                throw new Exception($\"Input types must be unique.There is already an input type named \\\"{inputTypeName}\\\"\");\n            }\n\n            _allowedInputTypes.Add(inputTypeName, typeof(TInputType));\n        }\n\n        public IInputType GetOrNullAllowedInputType(string name)\n        {\n            return _allowedInputTypes.ContainsKey(name)\n                ? (IInputType)Activator.CreateInstance(_allowedInputTypes[name])\n                : null;\n        }\n\n        public List<string> GetAllAllowedInputTypeNames()\n        {\n            return _allowedInputTypes.Keys.ToList();\n        }\n\n        public List<IInputType> GetAllAllowedInputTypes()","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/aspnetboilerplate/aspnetboilerplate/blob/2323c13a152aa0ebfb37af3830f687d7f5b53795/src/Abp/DynamicEntityProperties/DynamicEntityPropertyDefinitionManager.cs#L39-L75","documentation":"AddAllowedInputType maintains a dictionary of allowed input types keyed by the input type's name; registering a second IInputType whose resolved name equals an existing one throws a plain Exception because input type names must be unique for lookup (GetOrNullAllowedInputType). Duplicate names would make name-based resolution ambiguous.","triggerScenarios":"Calling AddAllowedInputType<T>() with two different classes that resolve to the same input type name — e.g. two custom input types both returning Name = \"checkbox\", or re-registering the same input type twice in different modules' PreInitialize.","commonSituations":"Copy-pasted input type classes where the Name string wasn't changed; base/subclass pairs sharing the same Name value; module double-initialization running registration twice.","solutions":["Give each input type implementation a distinct, unique Name","Skip registration if _allowedInputTypes already contains the name","Rename one of the colliding input types (prefix with feature/module name)","Ensure PreInitialize/registration code runs only once per app start"],"exampleFix":"// before\npublic class DropdownInput : InputTypeBase { public override string Name => \"combobox\"; }\npublic class ComboboxInput : InputTypeBase { public override string Name => \"combobox\"; } // duplicate\n// after\npublic class DropdownInput : InputTypeBase { public override string Name => \"dropdown\"; }\npublic class ComboboxInput : InputTypeBase { public override string Name => \"combobox\"; }","handlingStrategy":"validation","validationCode":"string name = InputTypeBase.GetName<TInputType>();\nif (manager.GetOrNullAllowedInputType(name) != null) { return; } // already registered\nmanager.AddAllowedInputType<TInputType>();","typeGuard":"bool IsUniqueName<T>() where T : IInputType { var n = InputTypeBase.GetName<T>(); return !string.IsNullOrWhiteSpace(n) && existingNames.All(x => x != n); }","tryCatchPattern":"try { manager.AddAllowedInputType<TInputType>(); } catch (Exception ex) when (ex.Message.StartsWith(\"Input types must be unique\")) { // duplicate name — rename input type or skip registration }","preventionTips":["Give every IInputType implementation a globally unique Name string","Search the solution for the intended Name literal before adding a new input type","Register each input type in a single location/module","Add a startup test asserting no duplicate input type names"],"tags":["dynamic-entity-properties","input-type","duplicate-registration"],"backgroundTag":"file-already-exists","analyzedSha":"2323c13a152aa0ebfb37af3830f687d7f5b53795","analyzedAt":"2026-09-08T08:00:50.638Z","contentChangedAt":"2026-09-08T08:00:50.638Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}