Humanizr/Humanizer · error · InvalidOperationException
Inflection lexeme '{lexemeId}' form '{name}' preferred value
Error message
Inflection lexeme '{lexemeId}' form '{name}' preferred value must be accepted. What it means
For each form, the 'preferred:' value must also appear in the 'accepted:' list (ordinal comparison). ParseForm throws when preferred is not a member of accepted, because the preferred form is the default and must be an accepted spelling.
Source
Thrown at src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs:392
$"Inflection lexeme '{lexemeId}' form '{name}' must define preferred"),
casing,
ownerScripts,
subject,
allowStemPlaceholder: false,
allowNonLetters: true);
var accepted = NormalizeAuthoredTexts(
GetRequiredStrings(
mapping,
"accepted",
$"Inflection lexeme '{lexemeId}' form '{name}' must define accepted"),
casing,
ownerScripts,
subject,
allowStemPlaceholder: false,
allowNonLetters: true);
if (!accepted.Contains(preferred, StringComparer.Ordinal))
{
throw new InvalidOperationException(
$"Inflection lexeme '{lexemeId}' form '{name}' preferred value must be accepted.");
}
return new(preferred, accepted);
}
static ImmutableArray<InflectionRuleInput> ParseRules(
SimpleYamlMapping mapping,
ImmutableHashSet<string> sourceIds,
ImmutableHashSet<string> lexemeIds,
ImmutableArray<string> ownerScripts,
string cardinalRule,
string casing)
{
if (!mapping.TryGetValue("rules", out var value))
{
return [];
}View on GitHub (pinned to ffc2b77c0f)
Solutions
- Add the preferred value verbatim to the accepted list
Example fix
# before
other:
preferred: 'cats'
accepted:
- 'cat'
# after
other:
preferred: 'cats'
accepted:
- 'cats' Defensive patterns
Strategy: validation
Validate before calling
foreach (var form in allForms)
if (!form.Accepted.Contains(form.Preferred, StringComparer.Ordinal))
Report($"{locale}: preferred '{form.Preferred}' must appear in accepted."); Type guard
static bool PreferredIsAccepted(Form f) =>
f.Accepted.Contains(f.Preferred, StringComparer.Ordinal); Prevention
- After editing 'preferred', paste the same value into 'accepted'
- Re-check after changing the bundle 'casing' mode
When it happens
Trigger: 'preferred:' names a spelling that is absent from (or differs in case/spacing from) every entry in 'accepted:'.
Common situations: Editing the preferred spelling and forgetting to mirror it in the accepted list; a casing-mode change that alters preferred but not accepted.
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/77e1b4a3069d9f42.
Report an issue: GitHub.