MudBlazor/MudBlazor · error · ArgumentOutOfRangeException
Unknown operator name.
Error message
Unknown operator name.
What it means
FilterOperator.GetOperatorName maps each filter-operator enum value to a localized display string via a switch. Several arms are commented out (Boolean.Is, DateTime.Is/IsNot/Empty/NotEmpty, Guid.Equal/NotEqual), so passing any of those operator values reaches the default arm and throws ArgumentOutOfRangeException. It also fires for any out-of-range operator value.
Source
Thrown at src/MudBlazor/Components/DataGrid/FilterOperator.cs:384
Number.GreaterThanOrEqual => LanguageResource.MudDataGrid_GreaterThanOrEqualSign,
Number.LessThan => LanguageResource.MudDataGrid_LessThanSign,
Number.LessThanOrEqual => LanguageResource.MudDataGrid_LessThanOrEqualSign,
//Number.Empty => LanguageResource.MudDataGrid_IsEmpty,
//Number.NotEmpty => LanguageResource.MudDataGrid_IsNotEmpty,
Enum.Is => LanguageResource.MudDataGrid_Is,
Enum.IsNot => LanguageResource.MudDataGrid_IsNot,
//Boolean.Is => LanguageResource.MudDataGrid_Is,
//DateTime.Is => LanguageResource.MudDataGrid_Is,
//DateTime.IsNot => LanguageResource.MudDataGrid_IsNot,
DateTime.After => LanguageResource.MudDataGrid_IsAfter,
DateTime.OnOrAfter => LanguageResource.MudDataGrid_IsOnOrAfter,
DateTime.Before => LanguageResource.MudDataGrid_IsBefore,
DateTime.OnOrBefore => LanguageResource.MudDataGrid_IsOnOrBefore,
//DateTime.Empty => LanguageResource.MudDataGrid_IsEmpty,
//DateTime.NotEmpty => LanguageResource.MudDataGrid_IsNotEmpty,
//Guid.Equal => LanguageResource.MudDataGrid_Equals,
//Guid.NotEqual => LanguageResource.MudDataGrid_NotEquals,
_ => throw new ArgumentOutOfRangeException(nameof(operatorName), operatorName, "Unknown operator name.")
};
}
}
View on GitHub (pinned to bdb3acd5dd)
Solutions
- Only surface operators that FilterOperator.GetOperatorByDataType returns for the column's data type.
- Avoid requesting GetOperatorName for commented-out operator values.
- If you must reference Guid/Boolean/DateTime equality, use the operators that remain active (e.g. Guid.Equal may be unsupported — use a supported alternative or filter manually).
Example fix
// before var name = FilterOperator.GetOperatorName(FilterOperator.DateTime.Empty); // after // use a supported DateTime operator, e.g.: var name = FilterOperator.GetOperatorName(FilterOperator.DateTime.Before);
Defensive patterns
Strategy: try-catch
Validate before calling
var allowed = FilterOperator.GetOperatorByDataType(propertyType);
if (!allowed.Contains(op))
{
// skip or pick a supported operator
} Type guard
static bool IsOperatorSupported(FilterOperator op, Type type)
=> FilterOperator.GetOperatorByDataType(type).Contains(op); Try / catch
try { name = FilterOperator.GetOperatorName(op); }
catch (ArgumentOutOfRangeException) { /* operator not localized; skip it */ } Prevention
- Only request display names for operators returned by GetOperatorByDataType.
- Avoid surfacing commented-out operators in custom filter UI.
- Handle the upgrade case where operator enums were deprecated.
When it happens
Trigger: Requesting the display name for an operator whose localization arm is commented out (e.g. FilterOperator.DateTime.Empty, FilterOperator.Guid.Equal); passing an undefined operator enum integer; the filter UI trying to render a label for a disabled operator.
Common situations: Custom filter templates that surface every operator including the disabled ones; upgrading MudBlazor where an operator was deprecated; constructing a FilterDefinition with an operator not yet localized.
Related errors
- Invalid filter operators for {PropertyType?.Name}: {string.J
- {GetType()} can only accept one item source from its paramet
- {GetType()} can only accept one item source from its paramet
- {GetType()} can only accept one item source from its paramet
- Do not supply both '{nameof(VirtualizeServerData)}' and '{na
AI-assisted analysis of MudBlazor/MudBlazor@bdb3acd5dd (2026-08-13).
Data as JSON: /api/errors/780ad6d7c0433fe4.
Report an issue: GitHub.