{"record":{"id":"3e44e3b0c46b1f40","repo":"Humanizr/Humanizer","slug":"locale-localecode-surfaces-must-be-a-mapping","errorCode":null,"errorMessage":"Locale '{localeCode}.surfaces' must be a mapping.","messagePattern":"Locale '(.+?)\\.surfaces' must be a mapping\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs","lineNumber":105,"sourceCode":"            var variantOf = root.GetScalar(\"variantOf\");\n\n            SimpleYamlMapping surfaces;\n            if (!root.TryGetValue(\"surfaces\", out var surfacesValue))\n            {\n                if (string.IsNullOrWhiteSpace(variantOf))\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}' must define required top-level property 'surfaces'.\");\n                }\n\n                surfaces = new SimpleYamlMapping(\n                    ImmutableDictionary<string, SimpleYamlValue>.Empty.WithComparers(StringComparer.Ordinal));\n            }\n            else\n            {\n                surfaces = surfacesValue is SimpleYamlMapping surfacesMapping\n                    ? surfacesMapping\n                    : throw new InvalidOperationException($\"Locale '{localeCode}.surfaces' must be a mapping.\");\n            }\n\n            foreach (var surface in surfaces.Values)\n            {\n                if (!SupportedSurfaceNames.Contains(surface.Key, StringComparer.Ordinal))\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces' defines unsupported surface '{surface.Key}'. \" +\n                        $\"Supported surfaces: {string.Join(\", \", SupportedSurfaceNames)}.\");\n                }\n\n                if (surface.Value is not SimpleYamlMapping)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.{surface.Key}' must be a mapping.\");\n                }\n\n                RejectExplicitDefaultEngines(localeCode, $\"surfaces.{surface.Key}\", surface.Value);","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L87-L123","documentation":"`surfaces:` must be a YAML mapping (CanonicalLocaleAuthoring.cs:103-105). A scalar or sequence here cannot hold named surfaces, so the generator rejects it.","triggerScenarios":"`surfaces: en` or `surfaces: [clock, number]` instead of a keyed mapping; a stray `:` placement turning it into a scalar.","commonSituations":"Hand-typing the surfaces line; bad copy-paste from a list.","solutions":["Make surfaces a mapping: `surfaces:` followed by indented `key:` blocks.","For an empty stub use `surfaces: {}` (flow mapping).","Re-run the build."],"exampleFix":"# before\nsurfaces: clock\n# after\nsurfaces:\n  clock: {}","handlingStrategy":"validation","validationCode":"import yaml, sys\ndoc = yaml.safe_load(open(sys.argv[1], encoding='utf-8'))\nif 'surfaces' in doc:\n    assert isinstance(doc['surfaces'], dict), 'surfaces: 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"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}