Humanizr/Humanizer · error · InvalidOperationException

Inflection lexeme '{id}' defines unsupported display categor

Error message

Inflection lexeme '{id}' defines unsupported display category '{category}'.

What it means

The keys under a lexeme's 'forms.display' must be valid CLDR plural categories: 'zero', 'one', 'two', 'few', 'many', 'other'. ParseLexemes throws when an author writes a key outside the PluralCategories set.

Source

Thrown at src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs:324

                var display = ImmutableDictionary.CreateBuilder<string, InflectionFormInput>(StringComparer.Ordinal);
                foreach (var category in ReachableCategories(cardinalRule))
                {
                    display[category] = ParseForm(
                        displayMapping,
                        category,
                        alternateName: null,
                        id,
                        ownerScripts,
                        casing);
                }

                foreach (var category in displayMapping.Values.Keys.OrderBy(
                             static value => value,
                             StringComparer.Ordinal))
                {
                    if (!PluralCategories.Contains(category))
                    {
                        throw new InvalidOperationException(
                            $"Inflection lexeme '{id}' defines unsupported display category '{category}'.");
                    }

                    if (!display.ContainsKey(category))
                    {
                        display[category] = ParseForm(
                            displayMapping,
                            category,
                            alternateName: null,
                            id,
                            ownerScripts,
                            casing);
                    }
                }

                lexemes.Add(new(
                    id,
                    countability,

View on GitHub (pinned to ffc2b77c0f)

Solutions

  1. Rename the key to a valid CLDR category (typically 'one' and 'other')
  2. Remove the unsupported key

Example fix

# before
          display:
            singular:
              preferred: 'cat'
              accepted: [ 'cat' ]
# after
          display:
            one:
              preferred: 'cat'
              accepted: [ 'cat' ]
Defensive patterns

Strategy: validation

Validate before calling

var cats = new[] { "zero", "one", "two", "few", "many", "other" };
foreach (var lexeme in lexemes)
foreach (var key in lexeme.Forms.Display.Keys)
    if (!cats.Contains(key))
        Report($"{locale}: unsupported display category '{key}'.");

Type guard

static bool CategoryValid(string c) =>
    c is "zero" or "one" or "two" or "few" or "many" or "other";

Prevention

When it happens

Trigger: A lexeme 'display:' block contains a category key not in {zero, one, two, few, many, other} (e.g. 'singular', 'plural', 'many2').

Common situations: Using 'singular'/'plural' instead of 'one'/'other'; leftover keys from an older schema; adding a category not reachable by the cardinal rule.

Related errors


AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13). Data as JSON: /api/errors/d59abc6f10d78437. Report an issue: GitHub.