{"record":{"id":"28b741540c5602d9","repo":"Humanizr/Humanizer","slug":"locale-localecode-headings-key-must-be-a-seq","errorCode":null,"errorMessage":"Locale '{localeCode}.headings.{key}' must be a sequence.","messagePattern":"Locale '(.+?)\\.headings\\.(.+?)' must be a sequence\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs","lineNumber":840,"sourceCode":"            string localeCode,\n            ImmutableDictionary<string, SimpleYamlValue> features)\n        {\n            return !features.TryGetValue(\"inflection\", out var inflectionValue)\n                ? null\n                : 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","sourceCodeStart":822,"sourceCodeEnd":858,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs#L822-L858","documentation":"Each headings sub-key ('full' or 'short') must be a YAML sequence (list) of name strings. If the value under that key is a scalar or a nested mapping, the heading parser cannot iterate entries and rejects it.","triggerScenarios":"A locale sets 'headings.full:' or 'headings.short:' to a scalar string or a mapping instead of a list. For example 'full: January' instead of 'full:\\n  - January'.","commonSituations":"Inline scalar assignment instead of a list; indentation error causing the sequence items to parse as a mapping value; YAML flow-style mistakes.","solutions":["Change the value under the named key to a YAML block sequence (one '- ' entry per heading).","Verify each line under the key starts with '- ' at the correct indent level.","Use a known-good locale file as an indentation reference."],"exampleFix":"# before\nheadings:\n  full: January, February\n\n# after\nheadings:\n  full:\n    - January\n    - February","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 val is not None and not isinstance(val, list):\n                print(f'{f.name}: headings.{key} must be a sequence, got {type(val).__name__}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Each headings sub-key must be a YAML list, not an inline scalar or mapping.","Use block sequence style ('- value') for readability and correctness.","Validate indentation so list items nest properly under each sub-key."],"tags":["locale","yaml","source-generator","headings","sequence"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}