{"record":{"id":"2e1b9135ddc913be","repo":"Humanizr/Humanizer","slug":"unknown-ordinalizer-profile","errorCode":null,"errorMessage":"Unknown ordinalizer profile.","messagePattern":"Unknown ordinalizer profile\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/OrdinalizerProfileCatalogInput.cs","lineNumber":78,"sourceCode":"            builder.AppendLine(\"{\");\n            builder.AppendLine(\"    public static IOrdinalizer Resolve(string kind, CultureInfo culture)\");\n            builder.AppendLine(\"    {\");\n            builder.AppendLine(\"        switch (kind)\");\n            builder.AppendLine(\"        {\");\n\n            foreach (var profile in generatedProfiles)\n            {\n                builder.Append(\"            case \");\n                builder.Append(QuoteLiteral(profile.ProfileName));\n                builder.Append(\": return \");\n                builder.Append(RequiresCulture(profile)\n                    ? CreateOrdinalizerExpression(profile, useCultureParameter: true)\n                    : GetCatalogPropertyName(profile.ProfileName));\n                builder.AppendLine(\";\");\n            }\n\n            builder.AppendLine(\"        }\");\n            builder.AppendLine(\"        throw new ArgumentOutOfRangeException(nameof(kind), kind, \\\"Unknown ordinalizer profile.\\\");\");\n            builder.AppendLine(\"    }\");\n            builder.AppendLine();\n\n            foreach (var profile in generatedProfiles)\n            {\n                if (RequiresCulture(profile))\n                {\n                    continue;\n                }\n\n                AppendLazyCachedMember(\n                    builder,\n                    \"    \",\n                    \"static\",\n                    \"IOrdinalizer\",\n                    GetCatalogPropertyName(profile.ProfileName),\n                    CreateOrdinalizerExpression(profile, useCultureParameter: false));\n                builder.AppendLine();","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/OrdinalizerProfileCatalogInput.cs#L60-L96","documentation":"This message is emitted into generated source code (OrdinalizerProfileCatalog.g.cs) as the default case of the Resolve switch. At runtime, OrdinalizerProfileCatalog.Resolve(kind, culture) throws ArgumentOutOfRangeException when the kind string does not match any compiled ordinalizer profile name. The catalog only contains profiles from locales whose ordinalizer feature was registered with UsesGeneratedProfile: true.","triggerScenarios":"Calling an ordinalizer API (e.g. number.ToOrdinalWords() or the Ordinalize extension) with a culture whose ordinalizer profile name is not in the compiled catalog. This happens when the locale is missing, the profile name doesn't match, or the feature wasn't registered as generated.","commonSituations":"A consumer upgrades Humanizer and a locale name changed. A consumer passes a custom culture string that doesn't correspond to any shipped ordinalizer profile.","solutions":["Verify the target locale has an ordinalizer YAML block with a matching profile name under src/Humanizer/Locales.","Ensure the ordinalizer feature is registered with UsesGeneratedProfile: true.","Fall back to a known-supported locale (e.g. 'en') for ordinalization if the requested locale is unsupported.","Confirm the culture name casing and hyphenation exactly match the compiled profile name."],"exampleFix":"// before — 'xx' has no ordinalizer profile\nvar ordinal = 1.ToOrdinalWords(\"xx\");\n\n// after — use a supported locale\nvar ordinal = 1.ToOrdinalWords(\"en\");","handlingStrategy":"validation","validationCode":"// Before calling an ordinalizer API with an arbitrary locale, verify support.\nvar culture = new CultureInfo(\"en\");\n// Use public APIs which fall back gracefully; guard if calling the internal catalog.","typeGuard":null,"tryCatchPattern":"try\n{\n    var ordinalizer = OrdinalizerProfileCatalog.Resolve(kind, culture);\n}\ncatch (ArgumentOutOfRangeException)\n{\n    ordinalizer = OrdinalizerProfileCatalog.Resolve(\"en\", culture);\n}","preventionTips":["Use the public Ordinalize/ToOrdinalWords extension methods rather than internal catalogs.","Verify the target culture is shipped with an ordinalizer block.","Test ordinalization for each locale your application supports."],"tags":["runtime","ordinalizer","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"}