{"record":{"id":"898489267c8a79b6","repo":"Humanizr/Humanizer","slug":"locale-localecode-surfaces-number-parse-must-b","errorCode":null,"errorMessage":"Locale '{localeCode}.surfaces.number.parse' must be a mapping, not a scalar or sequence.","messagePattern":"Locale '(.+?)\\.surfaces\\.number\\.parse' 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":234,"sourceCode":"                    $\"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))\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        }","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L216-L252","documentation":"`surfaces.number.parse` holds the words-to-number parser description and must be a mapping (CanonicalLocaleAuthoring.cs:230-236).","triggerScenarios":"Writing `parse: \"english\"` or a sequence under surfaces.number.","commonSituations":"Locale only needs spellout, so parse is given as a bare engine name by mistake.","solutions":["Provide `parse:` as a mapping (engine + arguments).","Omit parse if no parser override is needed.","Rebuild."],"exampleFix":"# before\nsurfaces:\n  number:\n    parse: english\n# after\nsurfaces:\n  number:\n    parse:\n      engine: \"english\"","handlingStrategy":"validation","validationCode":"import yaml, sys\ndoc = yaml.safe_load(open(sys.argv[1], encoding='utf-8'))\np = ((doc.get('surfaces') or {}).get('number') or {}).get('parse')\nif p is not None:\n    assert isinstance(p, dict), 'surfaces.number.parse 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-14T05:17:29.042Z"}