Humanizr/Humanizer · error · InvalidOperationException
Locale '{locale.LocaleCode}' does not resolve required capab
Error message
Locale '{locale.LocaleCode}' does not resolve required capability '{definition.Key}' from checked-in YAML. What it means
Thrown by LocaleCoverageInput.Create when a locale fails to resolve a non-optional capability from checked-in YAML. The coverage generator requires every shipped locale to provide or inherit each mandatory capability (formatter, phrases, inflection, numberToWords, wordsToNumber, ordinalizer, dateToOrdinalWords, timeOnlyToClockNotation, headings, list); a gap means the locale is incompletely specified.
Source
Thrown at src/Humanizer.SourceGenerators/Common/LocaleCoverageInput.cs:66
.Select(static diagnostic => diagnostic.GetMessage())
.OrderBy(static message => message, StringComparer.Ordinal)));
}
if (catalog.Locales.IsEmpty)
{
throw new InvalidOperationException("Locale coverage requires at least one canonical locale.");
}
var rows = ImmutableArray.CreateBuilder<LocaleCoverageRow>(catalog.Locales.Length);
foreach (var locale in catalog.Locales.OrderBy(static locale => locale.LocaleCode, StringComparer.Ordinal))
{
var coverage = ImmutableDictionary.CreateBuilder<string, LocaleCoverageStatus>(StringComparer.Ordinal);
foreach (var definition in Definitions)
{
var resolved = definition.IsResolved(locale);
if (!resolved && !definition.Optional)
{
throw new InvalidOperationException(
$"Locale '{locale.LocaleCode}' does not resolve required capability '{definition.Key}' from checked-in YAML.");
}
var contributes = definition.AuthoredFeatureNames.Any(locale.AuthoredFeatureNames.Contains);
LocaleCoverageStatus status;
if (contributes)
{
status = new LocaleCoverageStatus("own", null);
}
else if (resolved && locale.VariantOf is not null)
{
status = new LocaleCoverageStatus("via", locale.VariantOf);
}
else
{
status = new LocaleCoverageStatus(definition.Optional ? "platform" : "missing", null);
}
coverage[definition.Key] = status;
}View on GitHub (pinned to ffc2b77c0f)
Solutions
- Read the message: it names the locale code and the missing capability key (e.g. 'phrases', 'formatter').
- Add the missing section to the locale YAML, or set variantOf to a parent locale that provides it.
- For new locales, ensure all required capabilities are present before enabling locale coverage.
Defensive patterns
Strategy: validation
Validate before calling
# For the locale named in the message, confirm each required capability # section exists or is inherited via variantOf: # rg "^(formatter|phrases|inflection|numberToWords|wordsToNumber|ordinalizer|dateToOrdinalWords|dateOnlyToOrdinalWords|timeOnlyToClockNotation|headings|collectionFormatter):" src/Humanizer/Locales/<code>.yml
Prevention
- New locales must provide or inherit every required capability before enabling coverage.
- When deleting a capability section, confirm no locale relies on it as its own or inherited form.
- Use variantOf to inherit capabilities from a complete parent locale.
When it happens
Trigger: A locale YAML is missing one of the required capability sections and does not inherit it from a parent via variantOf. For example, a locale defines formatter but no phrases, or its variantOf parent also lacks the capability.
Common situations: Adding a new locale that is not yet complete, or deleting a capability section from an existing locale. The error names the locale code and the missing capability key so the contributor knows exactly what to add.
Related errors
- {diagnosticMessages}
- Locale coverage requires at least one canonical locale.
- Billion-word cardinal strategy requires a singular billion w
- Billion-word cardinal strategy requires a plural billion wor
- Property '{propertyName}' must be a string, array, or mappin
AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13).
Data as JSON: /api/errors/216144fcf5063fc9.
Report an issue: GitHub.