{"record":{"id":"654a2562765a2744","repo":"Humanizr/Humanizer","slug":"unsupported-default-ordinal-date-converter-conve","errorCode":null,"errorMessage":"Unsupported default ordinal-date converter '{converterTypeName}'.","messagePattern":"Unsupported default ordinal-date converter '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/OrdinalDateProfileCatalogInput.cs","lineNumber":176,"sourceCode":"            builder.AppendLine(\"}\");\n\n            if (!string.IsNullOrWhiteSpace(condition))\n            {\n                builder.AppendLine();\n                builder.AppendLine(\"#endif\");\n            }\n\n            context.AddSource(sourceName, SourceText.From(builder.ToString(), Encoding.UTF8));\n        }\n\n        static string CreateConverterExpression(OrdinalDateProfileDefinition profile, string converterTypeName) =>\n            profile.Engine switch\n            {\n                \"default\" => converterTypeName switch\n                {\n                    \"PatternDateToOrdinalWordsConverter\" => \"new DefaultDateToOrdinalWordConverter()\",\n                    \"PatternDateOnlyToOrdinalWordsConverter\" => \"new DefaultDateOnlyToOrdinalWordConverter()\",\n                    _ => throw new InvalidOperationException($\"Unsupported default ordinal-date converter '{converterTypeName}'.\")\n                },\n                \"pattern\" => CreatePatternExpression(profile, converterTypeName),\n                _ => throw new InvalidOperationException($\"Unsupported ordinal date engine '{profile.Engine}'.\")\n            };\n\n        static string CreatePatternExpression(OrdinalDateProfileDefinition profile, string converterTypeName)\n        {\n            var pattern = GetRequiredString(profile.Root, \"pattern\");\n            var hasGregorianMonths = profile.Months.Length > 0;\n            var hasHijriMonths = profile.HijriMonths.Length > 0;\n            var hasAnyMonthOverride = hasGregorianMonths || hasHijriMonths;\n\n            if (hasAnyMonthOverride && ContainsAbbreviatedMonth(pattern))\n            {\n                throw new InvalidOperationException(\n                    $\"Ordinal date profile '{profile.ProfileName}' uses MMM (abbreviated month) \" +\n                    \"which is not supported when calendar month overrides are active. \" +\n                    \"Only MMMM (full month name) substitution is supported.\");","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/OrdinalDateProfileCatalogInput.cs#L158-L194","documentation":"Thrown during source generation by CreateConverterExpression when an ordinal-date profile uses engine 'default', but the converter type name passed to the generator does not match either of the two supported types (PatternDateToOrdinalWordsConverter or PatternDateOnlyToOrdinalWordsConverter). This is an internal generator wiring error, not a user YAML error.","triggerScenarios":"The generator internally maps a locale's ordinal-date feature to a converter type name and then dispatches on it. If the converter type name is misspelled or newly introduced without updating this switch, the default arm fires. This would typically only happen during active development of the generator or locale infrastructure.","commonSituations":"A Humanizer developer adds a new ordinal-date converter type but forgets to add its case to the switch in CreateConverterExpression. Or the EmitDateCatalog method is called with a new converterTypeName argument that is not in the supported set.","solutions":["Check the EmitDateCatalog call that produced the error and verify its converterTypeName argument matches one of the two known values.","If a new converter type was added, add a new case arm mapping it to the correct constructor expression in the switch at OrdinalDateProfileCatalogInput.cs:172.","Ensure the engine value in the locale YAML is correctly set to 'default' only when one of the two supported converter types applies."],"exampleFix":"// before — a third converter type is passed but not handled\n\"default\" => converterTypeName switch\n{\n    \"PatternDateToOrdinalWordsConverter\" => \"new DefaultDateToOrdinalWordConverter()\",\n    \"PatternDateOnlyToOrdinalWordsConverter\" => \"new DefaultDateOnlyToOrdinalWordConverter()\",\n    _ => throw ...\n},\n\n// after — add the new case\n\"default\" => converterTypeName switch\n{\n    \"PatternDateToOrdinalWordsConverter\" => \"new DefaultDateToOrdinalWordConverter()\",\n    \"PatternDateOnlyToOrdinalWordsConverter\" => \"new DefaultDateOnlyToOrdinalWordConverter()\",\n    \"PatternCustomDateToOrdinalWordsConverter\" => \"new CustomDateToOrdinalWordConverter()\",\n    _ => throw ...\n},","handlingStrategy":"validation","validationCode":"// This is an internal generator error. Prevent it by ensuring that any\n// converterTypeName passed to EmitDateCatalog matches one of the two\n// supported values. If adding a new converter type, add its case to the\n// switch in CreateConverterExpression at OrdinalDateProfileCatalogInput.cs:172.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When adding a new ordinal-date converter type, add its case arm to CreateConverterExpression immediately.","Review all EmitDateCatalog call sites when changing converter type names.","Keep this file's switch arms synchronized with the catalog class names."],"tags":["source-generator","ordinal-date","internal","build-time"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}