{"record":{"id":"70def03a7a913c93","repo":"Humanizr/Humanizer","slug":"locale-localecode-surfaces-number-formatting-m","errorCode":null,"errorMessage":"Locale '{localeCode}.surfaces.number.formatting' must be a mapping, not a scalar or sequence.","messagePattern":"Locale '(.+?)\\.surfaces\\.number\\.formatting' 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":245,"sourceCode":"                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))\n            {\n                if (fmtValue is not SimpleYamlMapping fmtMapping)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.number.formatting' must be a mapping, not a scalar or sequence.\");\n                }\n\n                ValidateNumberFormattingBlock(localeCode, fmtMapping);\n                features[\"numberFormatting\"] = fmtMapping;\n            }\n        }\n\n        static SimpleYamlMapping NormalizeClockSurface(string localeCode, SimpleYamlMapping clockSurface)\n        {\n            if (clockSurface.DuplicateKeys.Contains(\"minuteWordsMap\"))\n            {\n                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.surfaces.clock.minuteWordsMap' defines duplicate entries; choose either the dense or sparse form.\");\n            }\n\n            if (!clockSurface.TryGetValue(\"minuteWordsMap\", out var minuteWordsMap))\n            {","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L227-L263","documentation":"`surfaces.number.formatting` must be a mapping of decimalSeparator/negativeSign/groupSeparator (CanonicalLocaleAuthoring.cs:241-247) before its contents are validated by ValidateNumberFormattingBlock.","triggerScenarios":"Writing `formatting: \",\"` or a list under surfaces.number.","commonSituations":"Trying to set just a decimal separator as a scalar.","solutions":["Use a mapping: `formatting:` then `decimalSeparator: \",\"`.","Provide at least one of the three allowed keys (a later check requires >=1).","Rebuild."],"exampleFix":"# before\nsurfaces:\n  number:\n    formatting: \",\"\n# after\nsurfaces:\n  number:\n    formatting:\n      decimalSeparator: \",\"","handlingStrategy":"validation","validationCode":"import yaml, sys\ndoc = yaml.safe_load(open(sys.argv[1], encoding='utf-8'))\nf = ((doc.get('surfaces') or {}).get('number') or {}).get('formatting')\nif f is not None:\n    assert isinstance(f, dict), 'surfaces.number.formatting 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"}