{"record":{"id":"dd65335b97485b4a","repo":"Humanizr/Humanizer","slug":"locale-localecode-path-must-be-a-sequence-or","errorCode":null,"errorMessage":"Locale '{localeCode}.{path}' must be a sequence or sparse numeric mapping.","messagePattern":"Locale '(.+?)\\.(.+?)' must be a sequence or sparse numeric mapping\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs","lineNumber":272,"sourceCode":"        static SimpleYamlMapping NormalizeClockSurface(string localeCode, SimpleYamlMapping clockSurface)\n        {\n            if (clockSurface.DuplicateKeys.Contains(\"minuteWordsMap\"))\n            {\n                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.surfaces.clock.minuteWordsMap' defines duplicate entries; choose either the dense or sparse form.\");\n            }\n\n            if (!clockSurface.TryGetValue(\"minuteWordsMap\", out var minuteWordsMap))\n            {\n                return clockSurface;\n            }\n\n            const string path = \"surfaces.clock.minuteWordsMap\";\n            SimpleYamlValue normalizedMinuteWordsMap = minuteWordsMap switch\n            {\n                SimpleYamlSequence sequence => NormalizeMinuteWordsSequence(localeCode, path, sequence),\n                SimpleYamlMapping mapping => NormalizeMinuteWordsMapping(localeCode, path, mapping),\n                _ => throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.{path}' must be a sequence or sparse numeric mapping.\")\n            };\n\n            var normalizedClockSurface = clockSurface.Values.ToBuilder();\n            normalizedClockSurface[\"minuteWordsMap\"] = normalizedMinuteWordsMap;\n            return new SimpleYamlMapping(normalizedClockSurface.ToImmutable());\n        }\n\n        static SimpleYamlMapping NormalizeMinuteWordsSequence(\n            string localeCode,\n            string path,\n            SimpleYamlSequence sequence)\n        {\n            if (sequence.Items.Length > 60)\n            {\n                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.{path}' must contain at most 60 entries for minute slots 0 through 59.\");\n            }","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L254-L290","documentation":"minuteWordsMap must be either a sequence (dense) or a numeric-keyed mapping (sparse); any other shape, e.g. a bare scalar, is rejected (CanonicalLocaleAuthoring.cs:268-274).","triggerScenarios":"Writing `minuteWordsMap: \"quarter\"` (scalar) or some unsupported node type.","commonSituations":"Hand-typing a single override as a scalar instead of a one-key mapping.","solutions":["Use the sequence form for a full 0-59 list, or a mapping keyed by integer minutes for sparse overrides.","For a single override use `minuteWordsMap:` then `15: \"a quarter\"`.","Rebuild."],"exampleFix":"# before\nsurfaces:\n  clock:\n    minuteWordsMap: \"quarter\"\n# after\nsurfaces:\n  clock:\n    minuteWordsMap:\n      15: \"a quarter\"","handlingStrategy":"validation","validationCode":"import yaml, sys\ndoc = yaml.safe_load(open(sys.argv[1], encoding='utf-8'))\nm = ((doc.get('surfaces') or {}).get('clock') or {}).get('minuteWordsMap')\nif m is not None:\n    assert isinstance(m, (list, dict)), 'minuteWordsMap must be a sequence or sparse 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","clock"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}