Humanizr/Humanizer · error · InvalidOperationException
Inflection rule '{id}' scope must target standalone nouns.
Error message
Inflection rule '{id}' scope must target standalone nouns. What it means
A rule's 'scope' must have 'pos: noun' and 'token: standalone'. The engine only applies productive rules to standalone noun tokens. ParseRules throws when either field differs.
Source
Thrown at src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs:453
}
ValidateSources(rule, sourceIds, $"Inflection rule '{id}'");
var direction = GetRequiredScalar(rule, "direction", $"Inflection rule '{id}' must define direction");
if (direction is not ("forward" or "reverse"))
{
throw new InvalidOperationException($"Inflection rule '{id}' has unsupported direction '{direction}'.");
}
var priority = GetRequiredInt(rule, "priority", $"Inflection rule '{id}' must define priority");
var scope = GetRequiredMapping(rule, "scope", $"Inflection rule '{id}' must define scope");
ValidateProperties(
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",View on GitHub (pinned to ffc2b77c0f)
Solutions
- Set 'scope.pos: 'noun'' and 'scope.token: 'standalone''
Example fix
# before
scope:
pos: 'noun'
token: 'phrase'
# after
scope:
pos: 'noun'
token: 'standalone' Defensive patterns
Strategy: validation
Validate before calling
foreach (var rule in rules)
if (rule.Scope.Pos != "noun" || rule.Scope.Token != "standalone")
Report($"{locale}: rule '{rule.Id}' scope must target standalone nouns."); Type guard
static bool ScopeIsStandaloneNoun(Scope sc) =>
sc.Pos == "noun" && sc.Token == "standalone"; Prevention
- Copy scope verbatim from ProductiveInflectionFixture; only vary countability/scripts
When it happens
Trigger: scope has 'pos:' other than 'noun', or 'token:' other than 'standalone' (e.g. 'token: phrase').
Common situations: Copying a fixture and changing token to 'phrase'; modeling a non-noun rule before the engine supports it.
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/f9ffd5b262cce4fc.
Report an issue: GitHub.