Humanizr/Humanizer · error · InvalidOperationException
Inflection rule '{id}' scope countability '{countability}' i
Error message
Inflection rule '{id}' scope countability '{countability}' is unsupported. What it means
Each value in a rule's 'scope.countability' list must be one of count, mass, collective, or plural-only. ParseRules throws when any entry falls outside the supported set.
Source
Thrown at src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs:465
scope,
$"Inflection rule '{id}' scope",
"pos", "countability", "token", "scripts");
if (GetRequiredScalar(scope, "pos", $"Inflection rule '{id}' scope must define pos") != "noun" ||
GetRequiredScalar(scope, "token", $"Inflection rule '{id}' scope must define token") != "standalone")
{
throw new InvalidOperationException(
$"Inflection rule '{id}' scope must target standalone nouns.");
}
var countabilities = GetRequiredStrings(
scope,
"countability",
$"Inflection rule '{id}' scope must define countability");
foreach (var countability in countabilities)
{
if (!Countabilities.Contains(countability))
{
throw new InvalidOperationException(
$"Inflection rule '{id}' scope countability '{countability}' is unsupported.");
}
}
var ruleScripts = GetRequiredStrings(
scope,
"scripts",
$"Inflection rule '{id}' scope must define scripts");
if (ruleScripts.Any(script => !ownerScripts.Contains(script, StringComparer.Ordinal)))
{
throw new InvalidOperationException(
$"Inflection rule '{id}' scope uses a script not declared by its owner.");
}
var match = GetRequiredMapping(rule, "match", $"Inflection rule '{id}' must define match");
ValidateProperties(
match,
$"Inflection rule '{id}' match",
"prefix", "suffix", "precedingNot", "preceding-not");View on GitHub (pinned to ffc2b77c0f)
Solutions
- Use only supported countability values: count, mass, collective, plural-only
Example fix
# before
countability:
- 'countable'
# after
countability:
- 'count' Defensive patterns
Strategy: validation
Validate before calling
var allowed = new[] { "count", "mass", "collective", "plural-only" };
foreach (var rule in rules)
foreach (var c in rule.Scope.Countability)
if (!allowed.Contains(c))
Report($"{locale}: rule '{rule.Id}' scope countability '{c}' unsupported."); Type guard
static bool ScopeCountabilityValid(IEnumerable<string> cs) =>
cs.All(c => c is "count" or "mass" or "collective" or "plural-only"); Prevention
- Reuse the same countability vocabulary across lexemes and rule scopes
When it happens
Trigger: A scope 'countability' list contains an unsupported value (e.g. 'uncountable', 'countable').
Common situations: Typo; using a linguistic term not in the supported set.
Related errors
- Inflection defines unsupported quantity selector; expected '
- Inflection quantitySelector 'exact-numeric-singleton' requir
- Inflection quantitySelector 'exact-numeric-singleton' cannot
- Inflection display category 'one' is unreachable without qua
- Active inflection bundle must define lexemes.
AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13).
Data as JSON: /api/errors/11a9acc05d1f723e.
Report an issue: GitHub.