{"record":{"id":"5a1aef13745bd9e2","repo":"Humanizr/Humanizer","slug":"unknown-words-to-number-profile","errorCode":null,"errorMessage":"Unknown words-to-number profile.","messagePattern":"Unknown words-to-number profile\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/WordsToNumberProfileCatalogInput.cs","lineNumber":72,"sourceCode":"            builder.AppendLine();\n            builder.AppendLine(\"static partial class WordsToNumberProfileCatalog\");\n            builder.AppendLine(\"{\");\n            builder.AppendLine(\"    public static IWordsToNumberConverter Resolve(string kind)\");\n            builder.AppendLine(\"    {\");\n            builder.AppendLine(\"        switch (kind)\");\n            builder.AppendLine(\"        {\");\n\n            foreach (var profile in profiles.OrderBy(static profile => profile.ProfileName, StringComparer.Ordinal))\n            {\n                builder.Append(\"            case \");\n                builder.Append(QuoteLiteral(profile.ProfileName));\n                builder.Append(\": return \");\n                builder.Append(GetCatalogPropertyName(profile.ProfileName));\n                builder.AppendLine(\";\");\n            }\n\n            builder.AppendLine(\"        }\");\n            builder.AppendLine(\"        throw new ArgumentOutOfRangeException(nameof(kind), kind, \\\"Unknown words-to-number profile.\\\");\");\n            builder.AppendLine(\"    }\");\n            builder.AppendLine();\n\n            foreach (var profile in profiles.OrderBy(static profile => profile.ProfileName, StringComparer.Ordinal))\n            {\n                AppendLazyCachedMember(\n                    builder,\n                    \"    \",\n                    \"static\",\n                    \"IWordsToNumberConverter\",\n                    GetCatalogPropertyName(profile.ProfileName),\n                    WordsToNumberEngineContractFactory.Create(profile));\n                builder.AppendLine();\n            }\n\n            builder.AppendLine(\"}\");\n            context.AddSource(\"WordsToNumberProfileCatalog.g.cs\", SourceText.From(builder.ToString(), Encoding.UTF8));\n        }","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/WordsToNumberProfileCatalogInput.cs#L54-L90","documentation":"This message is emitted into generated source code (WordsToNumberProfileCatalog.g.cs) as the default case of the Resolve switch. At runtime, WordsToNumberProfileCatalog.Resolve(kind) throws ArgumentOutOfRangeException when the kind string does not match any compiled words-to-number profile name. Only locales whose wordsToNumber feature was registered as generated appear in the catalog.","triggerScenarios":"Calling a words-to-number API with a culture whose words-to-number profile name is not compiled into the catalog. The locale may be missing a wordsToNumber block, or the profile name may not match the kind string being passed.","commonSituations":"A consumer requests words-to-number parsing for an unsupported locale. A developer working on words-to-number locale parity passes an unfinished profile name during testing.","solutions":["Verify the target locale has a wordsToNumber YAML block with a matching profile name under src/Humanizer/Locales.","Ensure the wordsToNumber feature is registered with UsesGeneratedProfile: true.","Fall back to a known-supported locale (e.g. 'en') if the requested locale is unsupported.","Confirm the culture name matches exactly the compiled profile name."],"exampleFix":"// before — 'xx' has no words-to-number profile\nvar number = \"five\".ToNumber(new CultureInfo(\"xx\"));\n\n// after — use a supported locale\nvar number = \"five\".ToNumber(new CultureInfo(\"en\"));","handlingStrategy":"validation","validationCode":"// Before calling a words-to-number API with an arbitrary locale, verify support.\nvar culture = new CultureInfo(\"en\");\n// Guard if calling the internal catalog directly.","typeGuard":null,"tryCatchPattern":"try\n{\n    var converter = WordsToNumberProfileCatalog.Resolve(kind);\n}\ncatch (ArgumentOutOfRangeException)\n{\n    converter = WordsToNumberProfileCatalog.Resolve(\"en\");\n}","preventionTips":["Use the public words-to-number API rather than calling the internal catalog Resolve directly.","Verify the target locale is shipped with a wordsToNumber block.","Test words-to-number parsing for each locale your application supports."],"tags":["runtime","words-to-number","generated-code","locale","argument-out-of-range"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}