{"record":{"id":"65174db74fbe94ea","repo":"Humanizr/Humanizer","slug":"locale-localecode-surfaces-number-words-must-b","errorCode":null,"errorMessage":"Locale '{localeCode}.surfaces.number.words' must be a mapping, not a scalar or sequence.","messagePattern":"Locale '(.+?)\\.surfaces\\.number\\.words' must be a mapping, not a scalar or sequence\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs","lineNumber":223,"sourceCode":"            return new LocaleDefinition(document.LocaleCode, document.VariantOf, features.ToImmutable());\n        }\n\n        static void AddNumberFeatures(\n            string localeCode,\n            SimpleYamlMapping numberSurface,\n            ImmutableDictionary<string, SimpleYamlValue>.Builder features)\n        {\n            foreach (var property in numberSurface.Values.Keys.Where(static property => property is not (\"words\" or \"parse\" or \"formatting\")))\n            {\n                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.surfaces.number' defines unsupported property '{property}'. Supported properties: words, parse, formatting.\");\n            }\n\n            if (numberSurface.TryGetValue(\"words\", out var wordsValue))\n            {\n                if (wordsValue is not SimpleYamlMapping wordsMapping)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.number.words' must be a mapping, not a scalar or sequence.\");\n                }\n\n                features[\"numberToWords\"] = wordsMapping;\n            }\n\n            if (numberSurface.TryGetValue(\"parse\", out var parseValue))\n            {\n                if (parseValue is not SimpleYamlMapping parseMapping)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.number.parse' must be a mapping, not a scalar or sequence.\");\n                }\n\n                features[\"wordsToNumber\"] = parseMapping;\n            }\n\n            if (numberSurface.TryGetValue(\"formatting\", out var fmtValue))","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L205-L241","documentation":"`surfaces.number.words` holds the number-to-words engine description and must be a mapping (CanonicalLocaleAuthoring.cs:219-225). A scalar or sequence cannot express the engine/argument/profile structure.","triggerScenarios":"Writing `words: \"engine\"` or `words: [...]` under surfaces.number.","commonSituations":"Porting a locale whose words block was a single string; truncating during migration.","solutions":["Provide `words:` as a mapping with the engine key and any arguments.","If the locale has no spellout, omit words entirely.","Rebuild."],"exampleFix":"# before\nsurfaces:\n  number:\n    words: default\n# after\nsurfaces:\n  number:\n    words:\n      engine: \"english\"\n      argument: \"\"","handlingStrategy":"validation","validationCode":"import yaml, sys\ndoc = yaml.safe_load(open(sys.argv[1], encoding='utf-8'))\nwords = ((doc.get('surfaces') or {}).get('number') or {}).get('words')\nif words is not None:\n    assert isinstance(words, dict), 'surfaces.number.words must be a mapping'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Author locales against the canonical schema; the error message lists the exact allowed names.","Run `dotnet build src/Humanizer/Humanizer.csproj` locally so the generator reports locale errors before push.","Copy an existing compliant locale file as your template rather than writing YAML from scratch."],"tags":["locale-authoring","yaml","source-generator","build","localization","number"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}