{"record":{"id":"594e327d27c1cdc6","repo":"Humanizr/Humanizer","slug":"locale-localecode-surfaces-ordinal-numeric-mus","errorCode":null,"errorMessage":"Locale '{localeCode}.surfaces.ordinal.numeric' must be a mapping, not a scalar or sequence.","messagePattern":"Locale '(.+?)\\.surfaces\\.ordinal\\.numeric' must be a mapping, not a scalar or sequence\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs","lineNumber":416,"sourceCode":"            }\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(\n                    $\"Locale '{localeCode}.surfaces.ordinal' defines unsupported property '{property}'. Supported properties: numeric, date, dateOnly.\");\n            }\n\n            if (ordinalSurface.TryGetValue(\"numeric\", out var numericValue))\n            {\n                if (numericValue is not SimpleYamlMapping numericMapping)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.ordinal.numeric' must be a mapping, not a scalar or sequence.\");\n                }\n\n                features[\"ordinalizer\"] = numericMapping;\n            }\n\n            if (ordinalSurface.TryGetValue(\"date\", out var dateValue))\n            {\n                if (dateValue is not SimpleYamlMapping dateMapping)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.ordinal.date' must be a mapping, not a scalar or sequence.\");\n                }\n\n                features[\"dateToOrdinalWords\"] = dateMapping;\n            }\n\n            if (ordinalSurface.TryGetValue(\"dateOnly\", out var dateOnlyValue))","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L398-L434","documentation":"Thrown by AddOrdinalFeatures when surfaces.ordinal.numeric is present but is not a YAML mapping. The numeric ordinal surface (ordinalizer) is itself a map of rules/keys, so a scalar or sequence value is rejected at build time.","triggerScenarios":"A locale YAML writes 'numeric: true' or 'numeric: [first, second]' instead of a key/value mapping. The type guard at CanonicalLocaleAuthoring.cs:414-418 fails because numericValue is not a SimpleYamlMapping.","commonSituations":"Using a boolean toggle to enable ordinalization; pasting an array of ordinal words; mis-indenting so the mapping becomes a scalar.","solutions":["Rewrite surfaces.ordinal.numeric as a mapping (the ordinalizer rule table expected by the generator).","If unsure of the required shape, copy the 'numeric' block from an existing full locale (e.g. src/Humanizer/Locales/en.yml) and translate it.","Rebuild to confirm the ordinal surface type check passes."],"exampleFix":"# before\nordinal:\n  numeric: true\n# after\nordinal:\n  numeric:\n    1: st\n    2: nd\n    3: rd","handlingStrategy":"validation","validationCode":"# Ensure surfaces.ordinal.numeric is a mapping, not a scalar/sequence.\n# YAML lint: 'numeric:' must be followed by an indented key/value block.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Model the ordinalizer as a mapping of rules, never a boolean toggle.","Copy the 'numeric' block from a reference locale and translate it.","Build after edits to confirm the type guard passes."],"tags":["localization","yaml","source-generator","locale","build","ordinal"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}