{"record":{"id":"d114573e80337a33","repo":"Humanizr/Humanizer","slug":"locale-localecode-surfaces-calendar-defines-un","errorCode":null,"errorMessage":"Locale '{localeCode}.surfaces.calendar' defines unsupported property '{property}'. Supported properties: months, monthsGenitive, hijriMonths.","messagePattern":"Locale '(.+?)\\.surfaces\\.calendar' defines unsupported property '(.+?)'\\. Supported properties: months, monthsGenitive, hijriMonths\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs","lineNumber":453,"sourceCode":"            {\n                if (dateOnlyValue is not SimpleYamlMapping dateOnlyMapping)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.ordinal.dateOnly' must be a mapping, not a scalar or sequence.\");\n                }\n\n                features[\"dateOnlyToOrdinalWords\"] = dateOnlyMapping;\n            }\n        }\n\n        static void AddCalendarFeatures(\n            string localeCode,\n            SimpleYamlMapping calendarSurface,\n            ImmutableDictionary<string, SimpleYamlValue>.Builder features)\n        {\n            foreach (var property in calendarSurface.Values.Keys.Where(static property => property is not (\"months\" or \"monthsGenitive\" or \"hijriMonths\")))\n            {\n                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.surfaces.calendar' defines unsupported property '{property}'. Supported properties: months, monthsGenitive, hijriMonths.\");\n            }\n\n            var hasMonths = calendarSurface.TryGetValue(\"months\", out var monthsValue);\n            if (hasMonths)\n            {\n                if (monthsValue is not SimpleYamlSequence monthsSeq || monthsSeq.Items.Length != 12)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.calendar.months' must be a sequence of exactly 12 strings.\");\n                }\n\n                if (monthsSeq.Items.Any(static item => item is not SimpleYamlScalar))\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.calendar.months' items must be scalar strings.\");\n                }\n            }","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L435-L471","documentation":"Thrown by AddCalendarFeatures when surfaces.calendar in a locale YAML contains a property other than the three allowed keys: months, monthsGenitive, hijriMonths. The calendar surface is closed, so any extra key (e.g. 'weekdays', 'quarters') is rejected at build time.","triggerScenarios":"A contributor adds an unsupported calendar key like 'weekdays' or 'seasons' under surfaces.calendar. The allow-list loop at CanonicalLocaleAuthoring.cs:451-456 flags it and throws.","commonSituations":"Migrating from CLDR data that includes many calendar dimensions; pasting calendar config from another library; adding locale-specific calendar data not yet modeled by the schema.","solutions":["Remove the unsupported property '{property}' from surfaces.calendar.","Keep only months, monthsGenitive, and/or hijriMonths, ensuring each is a 12-element sequence of strings.","If a new calendar dimension is genuinely required, extend AddCalendarFeatures and SupportedSurfaceNames in the generator before adding YAML."],"exampleFix":"# before\ncalendar:\n  months: [...]\n  weekdays: [...]\n# after\ncalendar:\n  months: [...]","handlingStrategy":"validation","validationCode":"# Validate calendar surface keys against the allow-list.\n$allowed = 'months','monthsGenitive','hijriMonths'\n# Parse the locale YAML and assert every key under surfaces.calendar is in $allowed.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the calendar surface is closed: months, monthsGenitive, hijriMonths only.","Move any weekday/quarter data out of this surface until the schema supports it.","Extend AddCalendarFeatures in the generator before adding a new calendar surface."],"tags":["localization","yaml","source-generator","locale","build","calendar"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}