{"record":{"id":"f8f90c4653ffc5bb","repo":"Humanizr/Humanizer","slug":"unrecognized-decimal-number-word-unrecognizednum","errorCode":null,"errorMessage":"Unrecognized decimal number word: {unrecognizedNumber}","messagePattern":"Unrecognized decimal number word: (.+?)","errorType":"exception","errorClass":"FormatException","httpStatus":null,"severity":"error","filePath":"src/Humanizer/Localisation/WordsToNumber/LocalizedWordsToDecimalNumberConverter.cs","lineNumber":48,"sourceCode":"        integerConverter = Configurator.GetWordsToNumberConverter(culture);\n        allowsJoinedTokens = integerConverter is EastAsianPositionalWordsToNumberConverter;\n        allowsEnglishOverflowComposition =\n            string.Equals(culture.TwoLetterISOLanguageName, \"en\", StringComparison.OrdinalIgnoreCase);\n        this.negativePrefixes = NormalizePrefixes(negativePrefixes);\n        this.negativeSuffixes = NormalizeSuffixes(negativeSuffixes);\n        fractionalDigits = CreateFractionalDigits(culture);\n    }\n\n    internal string DecimalMarker => decimalMarker;\n\n    /// <inheritdoc />\n    public decimal Convert(string words)\n    {\n        ArgumentNullException.ThrowIfNull(words);\n\n        if (!TryConvert(words, out var parsedValue, out var unrecognizedNumber))\n        {\n            throw new FormatException($\"Unrecognized decimal number word: {unrecognizedNumber}\");\n        }\n\n        return parsedValue;\n    }\n\n    /// <inheritdoc />\n    public bool TryConvert(string words, out decimal parsedValue) =>\n        TryConvert(words, out parsedValue, out _);\n\n    /// <inheritdoc />\n    public bool TryConvert(string words, out decimal parsedValue, out string? unrecognizedNumber)\n    {\n        parsedValue = default;\n        unrecognizedNumber = words ?? string.Empty;\n\n        if (words is null || string.IsNullOrWhiteSpace(words))\n        {\n            return false;","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer/Localisation/WordsToNumber/LocalizedWordsToDecimalNumberConverter.cs#L30-L66","documentation":"LocalizedWordsToDecimalNumberConverter.Convert throws this FormatException at line 48 when TryConvert cannot parse the decimal phrase, reporting the first unrecognized token. It differs from the integer 'unrecognized word' throw: this is decimal-specific and uses FormatException. Only the throwing Convert path raises it; TryConvert returns false with the unrecognized token.","triggerScenarios":"Calling ToDecimalNumber(words, culture) with a malformed decimal phrase: more than 28 fractional digits, an unrecognized fractional digit word, a missing/extra decimal marker, a value outside decimal range, or an unrecognized integer part for the locale's grammar.","commonSituations":"Free-form user text fed to ToDecimalNumber; locale mismatch; phrases with unsupported negative affixes; fractional runs longer than decimal's 28-29 significant digits; English scale overflow that still fits no decimal.","solutions":["Use TryToDecimalNumber(words, out var d, culture, out var bad) and branch on the boolean return.","Use the reported unrecognized token to locate the malformed fragment.","Verify the integer part parses with TryToNumber for that culture and that fractional digit count is within 1-28.","Confirm the phrase uses exactly one decimal marker and a supported negative affix."],"exampleFix":"// before\nvar d = \"two point banana\".ToDecimalNumber(CultureInfo.GetCultureInfo(\"en\"));\n// after\nif (\"two point banana\".TryToDecimalNumber(out var d, CultureInfo.GetCultureInfo(\"en\"), out var bad))\n    Console.WriteLine(d);\nelse\n    Console.WriteLine($\"unrecognized: {bad}\");","handlingStrategy":"validation","validationCode":"// Use the non-throwing decimal overload; it reports the bad token.\nif (!words.TryToDecimalNumber(out var d, culture, out var unrecognized))\n    return Result.Fail($\"unrecognized decimal token: {unrecognized}\");\nreturn Result.Ok(d);","typeGuard":null,"tryCatchPattern":"try { var d = words.ToDecimalNumber(culture); }\ncatch (FormatException ex) when (ex.Message.StartsWith(\"Unrecognized decimal number word\"))\n    { /* malformed decimal phrase */ }","preventionTips":["Prefer TryToDecimalNumber for untrusted input.","Ensure 1-28 fractional digit words and exactly one decimal marker.","Verify the integer part parses via TryToNumber for that culture.","Confirm negative affixes are locale-supported."],"tags":["words-to-decimal","decimal","formatexception","parsing","localization"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}