{"record":{"id":"cd1690c66cd07d32","repo":"Humanizr/Humanizer","slug":"locale-localecode-headings-key-must-contain","errorCode":null,"errorMessage":"Locale '{localeCode}.headings.{key}' must contain exactly 16 entries.","messagePattern":"Locale '(.+?)\\.headings\\.(.+?)' must contain exactly 16 entries\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs","lineNumber":845,"sourceCode":"                : inflectionValue as SimpleYamlMapping\n                ?? throw new InvalidOperationException($\"Locale '{localeCode}.inflection' must be a mapping.\");\n        }\n\n        static ImmutableArray<string> ParseHeadingSequence(SimpleYamlMapping mapping, string key, string localeCode)\n        {\n            if (!mapping.TryGetValue(key, out var headingValue))\n            {\n                throw new InvalidOperationException($\"Locale '{localeCode}.headings' must define '{key}'.\");\n            }\n\n            if (headingValue is not SimpleYamlSequence sequence)\n            {\n                throw new InvalidOperationException($\"Locale '{localeCode}.headings.{key}' must be a sequence.\");\n            }\n\n            if (sequence.Items.Length != 16)\n            {\n                throw new InvalidOperationException($\"Locale '{localeCode}.headings.{key}' must contain exactly 16 entries.\");\n            }\n\n            var headings = ImmutableArray.CreateBuilder<string>(16);\n            for (var index = 0; index < sequence.Items.Length; index++)\n            {\n                if (sequence.Items[index] is not SimpleYamlScalar scalar)\n                {\n                    throw new InvalidOperationException($\"Locale '{localeCode}.headings.{key}[{index}]' must be a scalar.\");\n                }\n\n                headings.Add(scalar.Value);\n            }\n\n            return headings.MoveToImmutable();\n        }\n\n        static T? TryResolveLocalePart<T>(\n            string localeCode,","sourceCodeStart":827,"sourceCodeEnd":863,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs#L827-L863","documentation":"The heading table for each variant must contain exactly 16 entries to match the generator's fixed-width ordinal heading slot allocation. A sequence with fewer or more entries produces an index-misaligned table, so the parser enforces the exact count.","triggerScenarios":"A locale's 'headings.full:' or 'headings.short:' sequence has any count other than 16 (e.g. 12 month names, or 7 day names, or an accidental extra entry).","commonSituations":"Confusing heading slots with month/day name counts; partial translation leaving placeholder entries; copy-paste introducing a duplicate or missing entry.","solutions":["Count the entries in the sequence named in the message and add or remove entries to reach exactly 16.","Compare entry count against a known-good locale's corresponding block.","Verify no trailing blank '- ' item or missing ordinal slot."],"exampleFix":"# before — 15 entries (one missing)\nheadings:\n  full:\n    - Zeroth\n    # ... 14 more, 15 total\n\n# after — exactly 16\nheadings:\n  full:\n    - Zeroth\n    # ... 15 more, 16 total","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 isinstance(data.get('headings'), dict):\n        for key in ('full', 'short'):\n            val = data['headings'].get(key)\n            if isinstance(val, list) and len(val) != 16:\n                print(f'{f.name}: headings.{key} has {len(val)} entries, expected 16')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Each headings sequence must contain exactly 16 entries — count them after authoring.","Do not confuse heading slots with month (12) or weekday (7) counts.","Diff against a known-good locale to verify entry count."],"tags":["locale","yaml","source-generator","headings","cardinality"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}