{"record":{"id":"8e253ae3c0e01794","repo":"Humanizr/Humanizer","slug":"unknown-ordinal-date-profile","errorCode":null,"errorMessage":"Unknown ordinal date profile.","messagePattern":"Unknown ordinal date profile\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/OrdinalDateProfileCatalogInput.cs","lineNumber":141,"sourceCode":"            builder.AppendLine();\n            builder.AppendLine(\"{\");\n            builder.Append(\"    public static \");\n            builder.Append(interfaceName);\n            builder.AppendLine(\" 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(\"            default: throw new ArgumentOutOfRangeException(nameof(kind), kind, \\\"Unknown ordinal date profile.\\\");\");\n            builder.AppendLine(\"        }\");\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                    interfaceName,\n                    GetCatalogPropertyName(profile.ProfileName),\n                    CreateConverterExpression(profile, converterTypeName));\n                builder.AppendLine();\n            }\n\n            builder.AppendLine(\"}\");\n","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/OrdinalDateProfileCatalogInput.cs#L123-L159","documentation":"This message is emitted into generated source code (OrdinalDateProfileCatalog.DateTo.g.cs or .DateOnly.g.cs) as the default case of the Resolve switch. At runtime, DateToOrdinalWordsProfileCatalog.Resolve(kind) or DateOnlyToOrdinalWordsProfileCatalog.Resolve(kind) throws ArgumentOutOfRangeException when the kind string does not match any compiled ordinal-date profile name.","triggerScenarios":"Calling a date-to-ordinal-words API (e.g. date.ToOrdinalWords()) with a culture whose ordinal-date feature is not registered or whose profile name differs from what the catalog compiled. The generated catalog only contains profiles from locales with UsesGeneratedProfile: true.","commonSituations":"A consumer requests ordinal-date conversion for a locale that has no ordinal-date YAML block, or whose ordinal-date profile name doesn't match the culture identifier being passed. Common after upgrading Humanizer when locale profile names change.","solutions":["Verify the target locale has an ordinal-date YAML block with the correct profile name under src/Humanizer/Locales.","Ensure the ordinal-date feature is registered with UsesGeneratedProfile: true.","Fall back to a known-supported locale (e.g. 'en-US') for ordinal-date conversion if the requested locale is not supported.","Check that the culture name you pass matches exactly (including casing and hyphens) the profile name compiled into the catalog."],"exampleFix":"// before — locale 'xx' has no ordinal-date profile\nvar words = date.ToOrdinalWords(new CultureInfo(\"xx\"));\n\n// after — use a supported locale\nvar words = date.ToOrdinalWords(new CultureInfo(\"en-US\"));","handlingStrategy":"validation","validationCode":"// Before calling an ordinal-date API with an arbitrary locale, verify support.\nvar culture = new CultureInfo(\"en-US\");\n// Use public APIs which fall back gracefully; if calling the internal catalog directly,\n// guard the profile name.","typeGuard":null,"tryCatchPattern":"try\n{\n    var converter = DateToOrdinalWordsProfileCatalog.Resolve(kind);\n}\ncatch (ArgumentOutOfRangeException)\n{\n    converter = DateToOrdinalWordsProfileCatalog.Resolve(\"en-US\");\n}","preventionTips":["Use the public date.ToOrdinalWords() extension methods rather than calling internal catalogs.","Verify that the target culture is shipped in src/Humanizer/Locales with an ordinal-date block.","Test ordinal-date conversion for each locale your application supports."],"tags":["runtime","ordinal-date","generated-code","locale","argument-out-of-range"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}