Humanizr/Humanizer · error · NotSupportedException
Decimal word parsing is not supported for the requested cult
Error message
Decimal word parsing is not supported for the requested culture.
What it means
UnsupportedWordsToDecimalNumberConverter.Convert throws NotSupportedException at line 18 to signal that the resolved culture has no decimal word parser. The decimal registry returns this stub for cultures without authored decimal words (unlike the integer registry, it does not fall back to English). Notably TryConvert returns false rather than throwing, so callers can avoid the exception entirely.
Source
Thrown at src/Humanizer/Localisation/WordsToNumber/UnsupportedWordsToDecimalNumberConverter.cs:18
namespace Humanizer;
/// <summary>
/// Fallback converter used when a locale does not support decimal word parsing.
/// </summary>
internal sealed class UnsupportedWordsToDecimalNumberConverter : IWordsToDecimalNumberConverter
{
internal static UnsupportedWordsToDecimalNumberConverter Instance { get; } = new();
UnsupportedWordsToDecimalNumberConverter()
{
}
/// <inheritdoc />
public decimal Convert(string words)
{
ArgumentNullException.ThrowIfNull(words);
throw new NotSupportedException("Decimal word parsing is not supported for the requested culture.");
}
/// <inheritdoc />
public bool TryConvert(string words, out decimal parsedValue)
{
parsedValue = default;
return false;
}
/// <inheritdoc />
public bool TryConvert(string words, out decimal parsedValue, out string? unrecognizedNumber)
{
parsedValue = default;
unrecognizedNumber = words ?? string.Empty;
return false;
}
}View on GitHub (pinned to ffc2b77c0f)
Solutions
- Use TryToDecimalNumber(words, out var d, culture) which returns false without throwing.
- Verify the culture has decimal-word support before calling Convert; fall back to a supported culture (e.g. en) if needed.
- Catch NotSupportedException only as a last resort if you must call Convert.
Example fix
// before
var d = words.ToDecimalNumber(CultureInfo.GetCultureInfo("xx")); // throws NotSupportedException
// after
if (words.TryToDecimalNumber(out var d, CultureInfo.GetCultureInfo("xx")))
Use(d);
else
UseFallback(); Defensive patterns
Strategy: validation
Validate before calling
// Try* returns false without throwing for unsupported cultures.
if (!words.TryToDecimalNumber(out var d, culture))
{
// culture lacks decimal-word support; fall back or skip
return Result.Unsupported();
}
return Result.Ok(d); Try / catch
try { var d = words.ToDecimalNumber(culture); }
catch (NotSupportedException ex) when (ex.Message.Contains("not supported for the requested culture"))
{ /* no decimal parser for this culture */ } Prevention
- Use TryToDecimalNumber to avoid NotSupportedException entirely.
- Confirm the culture has authored decimal words before calling Convert.
- Fall back to a supported culture (e.g. en) when decimal words are unavailable.
- Do not assume every locale has a decimal parser; only the integer registry falls back to English.
When it happens
Trigger: Calling ToDecimalNumber(words, culture) for a culture that lacks decimal-word support. The stub is returned by GetWordsToDecimalNumberConverter; Convert throws, but TryConvert returns false.
Common situations: Requesting decimal parsing for a locale that only authored integer words; assuming decimal words exist for every culture; using a neutral/unsupported culture code.
Related errors
- Unrecognized decimal number word: {unrecognizedNumber}
- Decimal marker must not be empty.
- Locale '{localeCode}' defines unsupported top-level property
- Locale '{localeCode}' must define required top-level propert
- Locale '{declaredLocale}' must match file locale '{localeCod
AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13).
Data as JSON: /api/errors/c771d651cef3755c.
Report an issue: GitHub.