{"record":{"id":"ab17e7d4b7933dc2","repo":"Humanizr/Humanizer","slug":"locale-localecode-surfaces-number-formatting-p","errorCode":null,"errorMessage":"Locale '{localeCode}.surfaces.number.formatting.{propertyName}' must be a scalar string, not a mapping or sequence.","messagePattern":"Locale '(.+?)\\.surfaces\\.number\\.formatting\\.(.+?)' must be a scalar string, not a mapping or sequence\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs","lineNumber":390,"sourceCode":"            ValidateOptionalFormattingProperty(localeCode, formatting, \"groupSeparator\");\n\n            if (formatting.Values.Count == 0)\n            {\n                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.surfaces.number.formatting' must define at least one property.\");\n            }\n        }\n\n        static void ValidateOptionalFormattingProperty(string localeCode, SimpleYamlMapping formatting, string propertyName)\n        {\n            if (!formatting.TryGetValue(propertyName, out var value))\n            {\n                return;\n            }\n\n            if (value is not SimpleYamlScalar scalar)\n            {\n                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.surfaces.number.formatting.{propertyName}' must be a scalar string, not a mapping or sequence.\");\n            }\n\n            if (string.IsNullOrEmpty(scalar.Value))\n            {\n                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.surfaces.number.formatting.{propertyName}' must be a non-empty string.\");\n            }\n        }\n\n        static void AddOrdinalFeatures(\n            string localeCode,\n            SimpleYamlMapping ordinalSurface,\n            ImmutableDictionary<string, SimpleYamlValue>.Builder features)\n        {\n            foreach (var property in ordinalSurface.Values.Keys.Where(static property => property is not (\"numeric\" or \"date\" or \"dateOnly\")))\n            {\n                throw new InvalidOperationException(","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L372-L408","documentation":"Thrown by ValidateOptionalFormattingProperty when a property under surfaces.number.formatting (decimalSeparator, negativeSign, or groupSeparator) is present but is not a scalar — it is a YAML mapping or sequence. These three values are single characters/strings, so structured values are rejected at build time.","triggerScenarios":"A locale YAML writes 'decimalSeparator:\\n  value: \",\"' (nested mapping) or a list form for one of the three formatting properties. The type check at CanonicalLocaleAuthoring.cs:386-392 fails because the value is not a SimpleYamlScalar.","commonSituations":"Pasting CLDR nested symbol objects; mis-indenting so the value becomes a child mapping; converting from a JSON config that wrapped symbols in objects.","solutions":["Rewrite the property as a single inline string scalar, e.g. 'decimalSeparator: \",\"'.","Verify YAML indentation so the value sits on the same line as the key.","Rebuild to confirm ValidateOptionalFormattingProperty passes."],"exampleFix":"# before\nnumber:\n  formatting:\n    decimalSeparator:\n      value: \",\"\n# after\nnumber:\n  formatting:\n    decimalSeparator: \",\"","handlingStrategy":"validation","validationCode":"# Ensure formatting properties are inline scalars:\n# 'decimalSeparator: \",\"' rather than nested mappings.\n# YAML lint: each of the three keys, if present, must have a scalar value.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write separators as single inline string values.","Avoid pasting CLDR nested symbol objects into the formatting block.","Build after edits to get the precise {propertyName} that failed."],"tags":["localization","yaml","source-generator","locale","build","number-formatting"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}