{"record":{"id":"8df489366fdda566","repo":"Humanizr/Humanizer","slug":"locale-localecode-calendar-must-be-a-mapping","errorCode":null,"errorMessage":"Locale '{localeCode}.calendar' must be a mapping.","messagePattern":"Locale '(.+?)\\.calendar' must be a mapping\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs","lineNumber":808,"sourceCode":"            foreach (var property in mapping.Values.Keys.Where(static property => property is not (\"full\" or \"short\")))\n            {\n                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.headings' defines unsupported property '{property}'. Supported properties: full, short.\");\n            }\n\n            return new HeadingSet(\n                ParseHeadingSequence(mapping, \"full\", localeCode),\n                ParseHeadingSequence(mapping, \"short\", localeCode));\n        }\n\n        static SimpleYamlMapping? ResolveCalendar(\n            string localeCode,\n            ImmutableDictionary<string, SimpleYamlValue> features)\n        {\n            return !features.TryGetValue(\"calendar\", out var calendarValue)\n                ? null\n                : calendarValue as SimpleYamlMapping\n                ?? throw new InvalidOperationException($\"Locale '{localeCode}.calendar' must be a mapping.\");\n        }\n\n        static SimpleYamlMapping? ResolveNumberFormatting(\n            string localeCode,\n            ImmutableDictionary<string, SimpleYamlValue> features)\n        {\n            return !features.TryGetValue(\"numberFormatting\", out var formattingValue)\n                ? null\n                : formattingValue as SimpleYamlMapping\n                ?? throw new InvalidOperationException($\"Locale '{localeCode}.numberFormatting' must be a mapping.\");\n        }\n\n        static SimpleYamlMapping? ResolveInflection(\n            string localeCode,\n            ImmutableDictionary<string, SimpleYamlValue> features)\n        {\n            return !features.TryGetValue(\"inflection\", out var inflectionValue)\n                ? null","sourceCodeStart":790,"sourceCodeEnd":826,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs#L790-L826","documentation":"The 'calendar' feature carries locale-specific calendar overrides (month names, date separators, first day of week, etc.) as a keyed mapping. A scalar or sequence value cannot express those overrides, so the calendar resolver rejects non-mapping nodes.","triggerScenarios":"A locale file provides 'calendar:' as a scalar or sequence instead of a mapping of calendar property overrides.","commonSituations":"Misunderstanding the calendar schema; truncating a calendar block; indentation drift causing the mapping children to detach.","solutions":["Ensure the 'calendar:' value is a YAML mapping with valid override keys.","If no calendar overrides are needed, remove the key entirely.","Compare with a locale that has calendar overrides for the correct key set."],"exampleFix":"# before\ncalendar: gregorian\n\n# after\ncalendar:\n  firstDayOfWeek: Monday","handlingStrategy":"validation","validationCode":"import yaml, pathlib\nlocales_dir = pathlib.Path('src/Humanizer/Locales')\nfor f in locales_dir.rglob('*.yml'):\n    data = yaml.safe_load(f.read_text())\n    if isinstance(data, dict) and 'calendar' in data:\n        if not isinstance(data['calendar'], dict):\n            print(f'{f.name}: calendar must be a mapping, got {type(data[\"calendar\"]).__name__}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provide calendar overrides as a mapping of property names to values.","Remove the calendar key if no overrides are needed.","Check a locale with calendar overrides for the supported property names."],"tags":["locale","yaml","source-generator","calendar","schema"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}