{"record":{"id":"ee50bd22190faec8","repo":"Humanizr/Humanizer","slug":"locale-localecode-inflection-must-be-a-mapping","errorCode":null,"errorMessage":"Locale '{localeCode}.inflection' must be a mapping.","messagePattern":"Locale '(.+?)\\.inflection' must be a mapping\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs","lineNumber":828,"sourceCode":"\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            }\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            }","sourceCodeStart":810,"sourceCodeEnd":846,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs#L810-L846","documentation":"The 'inflection' feature contains locale-specific inflection configuration as a keyed mapping. Because inflection rules are language-bound and must not cross language boundaries, the resolver also blocks cross-language inheritance; a non-mapping value is rejected outright.","triggerScenarios":"A locale file sets 'inflection:' to a scalar or sequence rather than a mapping of inflection properties.","commonSituations":"Misstructuring inflection data; indentation errors; leaving a placeholder scalar after partial editing.","solutions":["Ensure the 'inflection:' value is a mapping with the expected inflection sub-keys.","Remove the key if the locale has no inflection data.","Verify that the locale does not inherit inflection from a different-language parent (the resolver nulls inherited inflection across language subtags)."],"exampleFix":"# before\ninflection: german\n\n# after\ninflection:\n  rules:\n    plural: german","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 'inflection' in data:\n        if not isinstance(data['inflection'], dict):\n            print(f'{f.name}: inflection must be a mapping, got {type(data[\"inflection\"]).__name__}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Structure inflection as a mapping of rule properties.","Remember that inflection does not inherit across different language subtags — author it locally.","Remove the key if the locale has no inflection data."],"tags":["locale","yaml","source-generator","inflection","schema"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}