{"record":{"id":"5f32ba5d0dda9ffc","repo":"Humanizr/Humanizer","slug":"locale-localecode-numberformatting-must-be-a-m","errorCode":null,"errorMessage":"Locale '{localeCode}.numberFormatting' must be a mapping.","messagePattern":"Locale '(.+?)\\.numberFormatting' must be a mapping\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs","lineNumber":818,"sourceCode":"\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\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            }","sourceCodeStart":800,"sourceCodeEnd":836,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs#L800-L836","documentation":"The 'numberFormatting' feature holds locale-specific number format overrides (decimal separator, group separator, negative pattern, etc.) as a keyed mapping. A scalar or sequence node is structurally invalid and is rejected by the number-formatting resolver.","triggerScenarios":"A locale file sets 'numberFormatting:' to a scalar string or a sequence instead of a mapping of format properties.","commonSituations":"Authoring number format overrides incorrectly; indentation errors; copy-pasting from a source that used a different schema.","solutions":["Change the 'numberFormatting:' value to a mapping with the expected override keys.","Remove the key if no overrides are needed.","Reference an existing locale with numberFormatting overrides for the correct property names."],"exampleFix":"# before\nnumberFormatting: 1.234,56\n\n# after\nnumberFormatting:\n  decimalSeparator: \",\"\n  groupSeparator: \".\"","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 'numberFormatting' in data:\n        if not isinstance(data['numberFormatting'], dict):\n            print(f'{f.name}: numberFormatting must be a mapping, got {type(data[\"numberFormatting\"]).__name__}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Structure numberFormatting overrides as key-value pairs (decimalSeparator, groupSeparator, etc.).","Remove the key if the locale has no number format overrides.","Reference a locale with numberFormatting data for the correct property names."],"tags":["locale","yaml","source-generator","number-formatting","schema"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}