aspnetboilerplate/aspnetboilerplate · error · Exception
Input types must be unique.There is already an input type…
Error message
Input types must be unique.There is already an input type named \"{inputTypeName}\" What it means
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.
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
Example fix
// before
public class DropdownInput : InputTypeBase { public override string Name => "combobox"; }
public class ComboboxInput : InputTypeBase { public override string Name => "combobox"; } // duplicate
// after
public class DropdownInput : InputTypeBase { public override string Name => "dropdown"; }
public class ComboboxInput : InputTypeBase { public override string Name => "combobox"; } Defensive patterns
Strategy: validation
Validate before calling
string name = InputTypeBase.GetName<TInputType>();
if (manager.GetOrNullAllowedInputType(name) != null) { return; } // already registered
manager.AddAllowedInputType<TInputType>(); Type guard
bool IsUniqueName<T>() where T : IInputType { var n = InputTypeBase.GetName<T>(); return !string.IsNullOrWhiteSpace(n) && existingNames.All(x => x != n); } Try / catch
try { manager.AddAllowedInputType<TInputType>(); } catch (Exception ex) when (ex.Message.StartsWith("Input types must be unique")) { // duplicate name — rename input type or skip registration } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
- ArgumentNullException
- Entity already registered
- Setting group has already a Parent ().
- There is already a audit field configuration with name:
- There is already a filter with name:
AI-assisted analysis of aspnetboilerplate/aspnetboilerplate@2323c13a15 (2026-09-08).
Data as JSON: /api/errors/7f4128c5f7d11f4a.
Report an issue: GitHub.
Appendix: source
Thrown at src/Abp/DynamicEntityProperties/DynamicEntityPropertyDefinitionManager.cs:57
using (var provider = _iocManager.ResolveAsDisposable<DynamicEntityPropertyDefinitionProvider>(providerType))
{
provider.Object.SetDynamicEntityProperties(context);
}
}
}
public void AddAllowedInputType<TInputType>() where TInputType : IInputType
{
var inputTypeName = InputTypeBase.GetName<TInputType>();
if (inputTypeName.IsNullOrWhiteSpace())
{
throw new ArgumentNullException(typeof(TInputType).FullName + "/" + nameof(inputTypeName));
}
if (_allowedInputTypes.ContainsKey(inputTypeName))
{
throw new Exception($"Input types must be unique.There is already an input type named \"{inputTypeName}\"");
}
_allowedInputTypes.Add(inputTypeName, typeof(TInputType));
}
public IInputType GetOrNullAllowedInputType(string name)
{
return _allowedInputTypes.ContainsKey(name)
? (IInputType)Activator.CreateInstance(_allowedInputTypes[name])
: null;
}
public List<string> GetAllAllowedInputTypeNames()
{
return _allowedInputTypes.Keys.ToList();
}
public List<IInputType> GetAllAllowedInputTypes()View on GitHub (pinned to 2323c13a15)