Humanizr/Humanizer · error · InvalidOperationException
Unsupported ordinal date engine '{profile.Engine}'.
Error message
Unsupported ordinal date engine '{profile.Engine}'. What it means
Thrown during source generation by CreateConverterExpression when an ordinal-date profile's engine value is neither 'default' nor 'pattern'. The generator only supports these two engine identifiers for ordinal-date conversion; any other value causes the switch's default arm to fire.
Source
Thrown at src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/OrdinalDateProfileCatalogInput.cs:179
{
builder.AppendLine();
builder.AppendLine("#endif");
}
context.AddSource(sourceName, SourceText.From(builder.ToString(), Encoding.UTF8));
}
static string CreateConverterExpression(OrdinalDateProfileDefinition profile, string converterTypeName) =>
profile.Engine switch
{
"default" => converterTypeName switch
{
"PatternDateToOrdinalWordsConverter" => "new DefaultDateToOrdinalWordConverter()",
"PatternDateOnlyToOrdinalWordsConverter" => "new DefaultDateOnlyToOrdinalWordConverter()",
_ => throw new InvalidOperationException($"Unsupported default ordinal-date converter '{converterTypeName}'.")
},
"pattern" => CreatePatternExpression(profile, converterTypeName),
_ => throw new InvalidOperationException($"Unsupported ordinal date engine '{profile.Engine}'.")
};
static string CreatePatternExpression(OrdinalDateProfileDefinition profile, string converterTypeName)
{
var pattern = GetRequiredString(profile.Root, "pattern");
var hasGregorianMonths = profile.Months.Length > 0;
var hasHijriMonths = profile.HijriMonths.Length > 0;
var hasAnyMonthOverride = hasGregorianMonths || hasHijriMonths;
if (hasAnyMonthOverride && ContainsAbbreviatedMonth(pattern))
{
throw new InvalidOperationException(
$"Ordinal date profile '{profile.ProfileName}' uses MMM (abbreviated month) " +
"which is not supported when calendar month overrides are active. " +
"Only MMMM (full month name) substitution is supported.");
}
if (hasAnyMonthOverride)View on GitHub (pinned to ffc2b77c0f)
Solutions
- Open the locale YAML and set the ordinal-date engine to either 'default' or 'pattern' (lowercase, exact spelling).
- If the engine key is omitted, note that the default is 'pattern' (see AddProfile at line 73) — so this error only fires when an explicit non-matching value is present.
- Remove the engine key entirely if you want the default 'pattern' behavior.
Example fix
# locale YAML — before ordinalDate: engine: Default pattern: "dddd, d MMMM yyyy" # after ordinalDate: engine: pattern pattern: "dddd, d MMMM yyyy"
Defensive patterns
Strategy: validation
Validate before calling
// Before building, validate that the ordinal-date engine value in each // locale YAML is exactly 'default' or 'pattern' (lowercase, case-sensitive). // If the engine key is omitted, 'pattern' is the implicit default.
Prevention
- Use exactly 'default' or 'pattern' for the ordinal-date engine value — the switch is case-sensitive.
- Omit the engine key entirely if you want the default 'pattern' behavior.
- Run dotnet build after any locale YAML change to catch typos early.
When it happens
Trigger: A locale YAML has an ordinal-date block with an engine value that is misspelled, uses different casing (the switch is case-sensitive), or names an engine that was never implemented for ordinal dates.
Common situations: A maintainer copies a locale YAML from another feature (e.g. numberToWords) that uses a different engine name and forgets to change it to 'default' or 'pattern'. Or a typo such as 'Default' (capital D) or 'patten' breaks the case-sensitive match.
Related errors
- calendar.{key} items must be strings.
- Ordinal date profile '{profile.ProfileName}' uses MMM (abbre
- Ordinal date profile '{profile.ProfileName}' has calendar mo
- Ordinal date profile '{profile.ProfileName}' has calendar mo
- Billion-word cardinal strategy requires a singular billion w
AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13).
Data as JSON: /api/errors/804fad624416ae87.
Report an issue: GitHub.