{"record":{"id":"9bbb1d0237ae8999","repo":"Humanizr/Humanizer","slug":"locale-localecode-headings-key-index-must","errorCode":null,"errorMessage":"Locale '{localeCode}.headings.{key}[{index}]' must be a scalar.","messagePattern":"Locale '(.+?)\\.headings\\.(.+?)\\[(.+?)\\]' must be a scalar\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs","lineNumber":853,"sourceCode":"                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,\n            ImmutableArray<Diagnostic>.Builder diagnostics,\n            Func<string, ImmutableDictionary<string, SimpleYamlValue>, T?> resolver,\n            ImmutableDictionary<string, SimpleYamlValue> features)\n            where T : class\n        {\n            try\n            {\n                return resolver(localeCode, features);","sourceCodeStart":835,"sourceCodeEnd":871,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs#L835-L871","documentation":"Each entry in a headings sequence must be a YAML scalar (a plain or quoted string). If an entry is itself a nested mapping or sub-sequence, the parser cannot extract a string heading and rejects the specific entry by its index.","triggerScenarios":"One of the items under 'headings.full:' or 'headings.short:' is a mapping or nested list, e.g. '- full: January' instead of '- January'. The {index} placeholder identifies the offending position.","commonSituations":"Indentation drift causing a sub-key to attach as a list item; copy-pasting structured data into a flat string slot; leftover debugging nodes.","solutions":["Inspect the entry at the 0-based index named in the message and flatten it to a scalar string.","Remove any nested key-value structure from that list item.","Re-validate the whole sequence for similar structural issues at other indices."],"exampleFix":"# before — entry 0 is a mapping\nheadings:\n  full:\n    - name: January\n\n# after — entry 0 is a scalar\nheadings:\n  full:\n    - January","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):\n                for i, item in enumerate(val):\n                    if not isinstance(item, str):\n                        print(f'{f.name}: headings.{key}[{i}] must be a scalar string, got {type(item).__name__}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Each entry in a headings sequence must be a plain string, not a nested key-value or sub-list.","Avoid YAML flow-mapping syntax inside sequence items for headings.","Run a lint that checks every headings entry is a scalar type."],"tags":["locale","yaml","source-generator","headings","scalar"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}