Humanizr/Humanizer · error · InvalidOperationException
Unsupported inflection countability '{countability}'.
Error message
Unsupported inflection countability '{countability}'. What it means
The inflection catalog encodes noun countability as a bitmask from a fixed vocabulary: 'count', 'mass', 'collective', and 'plural-only'. Any other countability string in the YAML is rejected by GetCountabilityMask because it cannot be mapped to a bit position.
Source
Thrown at src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogValidation.cs:409
out var scriptValue);
mask |= scriptValue;
}
return (uint)mask;
}
static byte GetCountabilityMask(ImmutableArray<string> countabilities)
{
byte mask = 0;
foreach (var countability in countabilities)
{
mask |= countability switch
{
"count" => 1 << 0,
"mass" => 1 << 1,
"collective" => 1 << 2,
"plural-only" => 1 << 3,
_ => throw new InvalidOperationException(
$"Unsupported inflection countability '{countability}'.")
};
}
return mask;
}
static ImmutableArray<string> NormalizeGuards(
ImmutableArray<string> values,
string casing,
ImmutableArray<string> ownerScripts,
string subject)
{
return NormalizeAuthoredTexts(
values,
casing,
ownerScripts,
subject,View on GitHub (pinned to ffc2b77c0f)
Solutions
- Change the countability value to one of the four supported labels: 'count', 'mass', 'collective', or 'plural-only'.
- If the concept maps to multiple categories, list them as separate entries in the countability array.
- Check the locale authoring guide for the canonical countability vocabulary.
Example fix
# before
lexemes:
- id: 'water'
countability: ['uncountable']
# after
lexemes:
- id: 'water'
countability: ['mass'] Defensive patterns
Strategy: validation
Validate before calling
# Before building, verify countability values are from the allowed set.
python3 -c "
import yaml, sys
ALLOWED = {'count','mass','collective','plural-only'}
for f in sys.argv[1:]:
d = yaml.safe_load(open(f))
owners = (d.get('inflection',{}).get('owners') or [])
for owner in owners:
for lex in (owner.get('lexemes') or []):
for c in (lex.get('countability') or []):
if c not in ALLOWED:
print(f'{f}: unsupported countability {c!r} on lexeme {lex.get("id","")!r}')
" src/Humanizer/Locales/*.yml Prevention
- Use only the four canonical countability labels: count, mass, collective, plural-only.
- Do not invent synonyms like 'uncountable' (use 'mass') or 'invariable' (use 'plural-only').
- Keep the countability vocabulary documented in the locale authoring guide.
When it happens
Trigger: A lexeme's or rule's 'countability' field contains a value not in the set {count, mass, collective, plural-only}. The switch expression's default arm throws. For example, 'uncountable' or 'singular-only' would trigger this.
Common situations: Using a synonym like 'uncountable' instead of 'mass'. Copying terminology from a different inflection framework with different countability labels. Typo in the countability string.
Related errors
- Productive evidence '{direction}' requires at least 100 atte
- {subject} references unknown source '{source}'.
- Inflection source '{entry.Key}' must define non-empty kind a
- Inflection source '{entry.Key}' {optionalProperty} must be a
- Inflection rule '{ruleId}' output must contain exactly one b
AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13).
Data as JSON: /api/errors/610a222a0788580b.
Report an issue: GitHub.