{"record":{"id":"0df5ddf1de77392a","repo":"Humanizr/Humanizer","slug":"case-aware-citation-phrases-for-catalog-localeco-0df5dd","errorCode":null,"errorMessage":"Case-aware citation phrases for '{catalog.LocaleCode}' require '{path}'.","messagePattern":"Case-aware citation phrases for '(.+?)' require '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs","lineNumber":908,"sourceCode":"            DurationCaseCatalog catalog,\n            SimpleYamlValue? phrasesValue,\n            ImmutableArray<string> requiredMultipleForms)\n        {\n            if (!catalog.Realizations.TryGetValue(catalog.CitationCase, out var citation) ||\n                citation.Kind != DurationCaseRealizationKind.Authored ||\n                citation.Units.Count != 0)\n            {\n                return;\n            }\n\n            var path = $\"{catalog.LocaleCode}.phrases.duration\";\n            var phrases = phrasesValue is null\n                ? throw new InvalidOperationException(\n                    $\"Case-aware citation phrases for '{catalog.LocaleCode}' require the duration phrase surface.\")\n                : ExpectMapping(phrasesValue, $\"{catalog.LocaleCode}.phrases\");\n            if (!phrases.TryGetValue(\"duration\", out var durationValue))\n            {\n                throw new InvalidOperationException(\n                    $\"Case-aware citation phrases for '{catalog.LocaleCode}' require '{path}'.\");\n            }\n\n            var duration = ExpectMapping(durationValue, path);\n            foreach (var unitName in TimeUnits)\n            {\n                if (!duration.TryGetValue(unitName, out var phraseValue))\n                {\n                    throw new InvalidOperationException(\n                        $\"Case-aware citation phrases for '{catalog.LocaleCode}' require '{path}.{unitName}'.\");\n                }\n\n                ValidateReachableMultipleForms(\n                    phraseValue,\n                    $\"{path}.{unitName}\",\n                    requiredMultipleForms);\n            }\n        }","sourceCodeStart":890,"sourceCodeEnd":926,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs#L890-L926","documentation":"Thrown by ValidateCitationBaseDurationForms when the 'phrases' section exists but lacks a 'duration' sub-mapping. The path variable is constructed as {localeCode}.phrases.duration and the validator confirms the 'duration' key is present before iterating time units.","triggerScenarios":"The locale YAML has a 'phrases' block but it contains no 'duration' key (e.g. it only has other phrase categories like 'date' or 'number'), while the durationCases citation case requires duration phrases.","commonSituations":"A locale's phrases section was authored for other surfaces (dates, numbers) but the duration sub-section was never added, even though the locale declares case-aware duration phrases that depend on it.","solutions":["Add a 'duration' mapping under the 'phrases' section of the locale YAML.","Populate it with entries for every time unit (millisecond, second, minute, hour, day, week, month, year).","Rebuild to confirm the citation case finds its base-duration surface."],"exampleFix":"# before\nphrases:\n  date: ...\ndurationCases:\n  ...\n# after\nphrases:\n  date: ...\n  duration:\n    second: ...\n    minute: ...\n    ...\ndurationCases:\n  ...","handlingStrategy":"validation","validationCode":"# Verify phrases.duration exists when durationCases citation case is authored\n# python: phrases = yaml.get('phrases', {}); assert 'duration' in phrases","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include a 'duration' sub-mapping under 'phrases' for locales with case-aware durations.","Use an existing locale with duration cases as a structural template.","Build after structural changes to the phrases section to catch missing-key errors."],"tags":["humanizer","locale","yaml","source-generator","duration-cases","citation","build-time"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}