{"record":{"id":"3635129b36ba259e","repo":"Humanizr/Humanizer","slug":"locale-localecode-headings-must-be-a-mapping","errorCode":null,"errorMessage":"Locale '{localeCode}.headings' must be a mapping.","messagePattern":"Locale '(.+?)\\.headings' must be a mapping\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs","lineNumber":787,"sourceCode":"            return !features.TryGetValue(\"phrases\", out var phraseValue)\n                ? null\n                : phraseValue is SimpleYamlMapping mapping\n                ? LocalePhraseNormalization.Create(localeCode, mapping, preserveDurationCaseForms)\n                : throw new InvalidOperationException($\"Locale '{localeCode}.phrases' must be a mapping.\");\n        }\n\n        static HeadingSet? ResolveHeadings(\n            string localeCode,\n            ImmutableDictionary<string, SimpleYamlValue> features)\n        {\n            if (!features.TryGetValue(\"headings\", out var headingValue))\n            {\n                return null;\n            }\n\n            if (headingValue is not SimpleYamlMapping mapping)\n            {\n                throw new InvalidOperationException($\"Locale '{localeCode}.headings' must be a mapping.\");\n            }\n\n            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)","sourceCodeStart":769,"sourceCodeEnd":805,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs#L769-L805","documentation":"The 'headings' feature groups calendar heading sequences (month/day names) under 'full' and 'short' sub-keys, so it must be a YAML mapping. A scalar or sequence value has no named sub-properties and is rejected.","triggerScenarios":"A locale file sets 'headings:' to a scalar or to a bare sequence instead of a mapping containing 'full:' and 'short:' keys.","commonSituations":"Authoring heading data for the first time and omitting the wrapping mapping; indentation error causing heading sequences to attach at the wrong level.","solutions":["Wrap the heading data in a mapping with 'full:' and 'short:' keys.","Ensure each sub-key's value is itself a sequence of scalars.","Use an existing locale file (e.g. 'en.yml') as a structural template."],"exampleFix":"# before\nheadings:\n  - January\n  - February\n\n# after\nheadings:\n  full:\n    - January\n    - February\n  short:\n    - Jan\n    - Feb","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 'headings' in data:\n        if not isinstance(data['headings'], dict):\n            print(f'{f.name}: headings must be a mapping, got {type(data[\"headings\"]).__name__}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Wrap heading data under 'headings:' with 'full:' and 'short:' sub-keys.","Use 'en.yml' as a structural template when authoring headings for the first time.","Never place bare list items directly under 'headings:'."],"tags":["locale","yaml","source-generator","headings","schema"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}