{"record":{"id":"6bfa9d8dc017843e","repo":"Humanizr/Humanizer","slug":"locale-localecode-surfaces-clock-minutewordsmap","errorCode":null,"errorMessage":"Locale '{localeCode}.surfaces.clock.minuteWordsMap' defines duplicate entries; choose either the dense or sparse form.","messagePattern":"Locale '(.+?)\\.surfaces\\.clock\\.minuteWordsMap' defines duplicate entries; choose either the dense or sparse form\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs","lineNumber":258,"sourceCode":"\n            if (numberSurface.TryGetValue(\"formatting\", out var fmtValue))\n            {\n                if (fmtValue is not SimpleYamlMapping fmtMapping)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.number.formatting' must be a mapping, not a scalar or sequence.\");\n                }\n\n                ValidateNumberFormattingBlock(localeCode, fmtMapping);\n                features[\"numberFormatting\"] = fmtMapping;\n            }\n        }\n\n        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();","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L240-L276","documentation":"`surfaces.clock.minuteWordsMap` can appear in either a dense (sequence) or sparse (numeric-keyed mapping) form, but not both — and the key must not be duplicated (CanonicalLocaleAuthoring.cs:256-260). Duplicate keys usually mean both forms were pasted in.","triggerScenarios":"The minuteWordsMap key appears twice in the clock surface (DuplicateKeys includes it), e.g. one sequence form and one mapping form.","commonSituations":"Merging two locale branches that each added minuteWordsMap; hand-editing and leaving the old form.","solutions":["Keep exactly one minuteWordsMap entry: either the sequence or the sparse mapping.","If you want a few overrides, prefer the sparse form with integer keys 0-59.","Rebuild."],"exampleFix":"# before\nsurfaces:\n  clock:\n    minuteWordsMap: [zero, five, ten]\n    minuteWordsMap:\n      15: \"a quarter\"\n# after\nsurfaces:\n  clock:\n    minuteWordsMap:\n      15: \"a quarter\"","handlingStrategy":"validation","validationCode":"import yaml, sys\n# PyYAML collapses duplicate keys; use the generator's SimpleYamlParser or grep:\ntext = open(sys.argv[1], encoding='utf-8').read()\nassert text.count('minuteWordsMap:') <= 1, 'minuteWordsMap declared more than once'","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"}