Humanizr/Humanizer · error · InvalidOperationException
Case-aware citation phrases for '{catalog.LocaleCode}' requi
Error message
Case-aware citation phrases for '{catalog.LocaleCode}' require '{path}'. What it means
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.
Source
Thrown at src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs:908
DurationCaseCatalog catalog,
SimpleYamlValue? phrasesValue,
ImmutableArray<string> requiredMultipleForms)
{
if (!catalog.Realizations.TryGetValue(catalog.CitationCase, out var citation) ||
citation.Kind != DurationCaseRealizationKind.Authored ||
citation.Units.Count != 0)
{
return;
}
var path = $"{catalog.LocaleCode}.phrases.duration";
var phrases = phrasesValue is null
? throw new InvalidOperationException(
$"Case-aware citation phrases for '{catalog.LocaleCode}' require the duration phrase surface.")
: ExpectMapping(phrasesValue, $"{catalog.LocaleCode}.phrases");
if (!phrases.TryGetValue("duration", out var durationValue))
{
throw new InvalidOperationException(
$"Case-aware citation phrases for '{catalog.LocaleCode}' require '{path}'.");
}
var duration = ExpectMapping(durationValue, path);
foreach (var unitName in TimeUnits)
{
if (!duration.TryGetValue(unitName, out var phraseValue))
{
throw new InvalidOperationException(
$"Case-aware citation phrases for '{catalog.LocaleCode}' require '{path}.{unitName}'.");
}
ValidateReachableMultipleForms(
phraseValue,
$"{path}.{unitName}",
requiredMultipleForms);
}
}View on GitHub (pinned to ffc2b77c0f)
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.
Example fix
# before
phrases:
date: ...
durationCases:
...
# after
phrases:
date: ...
duration:
second: ...
minute: ...
...
durationCases:
... Defensive patterns
Strategy: validation
Validate before calling
# Verify phrases.duration exists when durationCases citation case is authored
# python: phrases = yaml.get('phrases', {}); assert 'duration' in phrases Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Case-aware citation phrases for '{catalog.LocaleCode}' requi
- Case-aware citation phrases for '{catalog.LocaleCode}' requi
- '{path}' must define exactly one of phrase, sameRenderedAs,
- Case overlay '{path}.phrase' must explicitly define singular
- Duration case phrases use unsupported plural rule '{pluralRu
AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13).
Data as JSON: /api/errors/0df5ddf1de77392a.
Report an issue: GitHub.