{"record":{"id":"fbd28daf41064c0c","repo":"Humanizr/Humanizer","slug":"locale-localecode-surfaces-surface-key-must","errorCode":null,"errorMessage":"Locale '{localeCode}.surfaces.{surface.Key}' 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":119,"sourceCode":"            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);\n            }\n\n            return new CanonicalLocaleDocument(\n                localeCode,\n                variantOf,\n                surfaces,\n                NormalizeCanonicalText(fileText));\n        }\n\n        internal static string Emit(CanonicalLocaleDocument document) => document.CanonicalText;\n\n        internal static LocaleDefinition ToLocaleDefinition(CanonicalLocaleDocument document)\n        {\n            var features = ImmutableDictionary.CreateBuilder<string, SimpleYamlValue>(StringComparer.Ordinal);","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L101-L137","documentation":"Each surface value under `surfaces:` must itself be a mapping (CanonicalLocaleAuthoring.cs:117-121). A scalar or sequence (e.g. `clock: '12-hour'`) cannot describe the surface's sub-properties.","triggerScenarios":"Writing `surfaces.clock: 'default'` or assigning a list to a surface instead of a keyed block.","commonSituations":"Shorthand authoring; converting a legacy scalar value into the canonical form incompletely.","solutions":["Convert the surface value to a mapping, e.g. `clock:` then indented properties.","If the surface only needs the default engine, either omit it or, for allowed paths, set `engine: \"default\"` inside a mapping.","Rebuild."],"exampleFix":"# before\nsurfaces:\n  compass: north\n# after\nsurfaces:\n  compass:\n    full: [\"north\",\"east\",\"south\",\"west\"]","handlingStrategy":"validation","validationCode":"import yaml, sys\ndoc = yaml.safe_load(open(sys.argv[1], encoding='utf-8'))\nif isinstance(doc.get('surfaces'), dict):\n    for k, v in doc['surfaces'].items():\n        assert isinstance(v, dict), f'surfaces.{k} 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-14T00:17:13.853Z"}